|
@@ -18,6 +18,10 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
|
|
|
|
|
|
BASE_IMAGE_NAME="smartbotic-vectorapi-build-base:debian13"
|
|
BASE_IMAGE_NAME="smartbotic-vectorapi-build-base:debian13"
|
|
|
|
|
+# Client version the server deb is compiled against. Must equal the version
|
|
|
|
|
+# installed on the deploy target: every 2.x client shares one SONAME, so a
|
|
|
|
|
+# mismatch installs cleanly and only segfaults on the next service restart.
|
|
|
|
|
+DB_CLIENT_VERSION="${DB_CLIENT_VERSION:-2.11.1-1}"
|
|
|
BUILD_JOBS="${BUILD_JOBS:-$(nproc)}"
|
|
BUILD_JOBS="${BUILD_JOBS:-$(nproc)}"
|
|
|
DEB_REPO_DIR="${DEB_REPO_DIR:-/data/dev/smartbotics/smartbotics-deb-repo}"
|
|
DEB_REPO_DIR="${DEB_REPO_DIR:-/data/dev/smartbotics/smartbotics-deb-repo}"
|
|
|
|
|
|
|
@@ -99,6 +103,8 @@ Options:
|
|
|
Environment variables:
|
|
Environment variables:
|
|
|
BUILD_JOBS Parallel build jobs (default: nproc)
|
|
BUILD_JOBS Parallel build jobs (default: nproc)
|
|
|
DEB_REPO_DIR Path to smartbotics-deb-repo (default: /data/dev/smartbotics/smartbotics-deb-repo)
|
|
DEB_REPO_DIR Path to smartbotics-deb-repo (default: /data/dev/smartbotics/smartbotics-deb-repo)
|
|
|
|
|
+ DB_CLIENT_VERSION libsmartbotic-db-client version to build against; must match
|
|
|
|
|
+ the deploy target (default: 2.11.1-1)
|
|
|
EOF
|
|
EOF
|
|
|
exit 0
|
|
exit 0
|
|
|
}
|
|
}
|
|
@@ -263,6 +269,23 @@ build_docker() {
|
|
|
log_info "Base image not found, building ${BASE_IMAGE_NAME}..."
|
|
log_info "Base image not found, building ${BASE_IMAGE_NAME}..."
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+ # Publishing re-indexes the apt pool, so the pinned client version is
|
|
|
|
|
+ # usually gone from the repo index. Vendor the .debs from the local
|
|
|
|
|
+ # deb-repo staging dir when they are there; otherwise the image falls
|
|
|
|
|
+ # back to installing that version from the repo.
|
|
|
|
|
+ local vendor_dir="$PROJECT_DIR/packaging/vendor"
|
|
|
|
|
+ rm -f "$vendor_dir"/*.deb
|
|
|
|
|
+ local found=0
|
|
|
|
|
+ for pkg in libsmartbotic-db-client libsmartbotic-db-client-dev; do
|
|
|
|
|
+ local deb="$DEB_REPO_DIR/dist/${pkg}_${DB_CLIENT_VERSION}_amd64.deb"
|
|
|
|
|
+ if [[ -f "$deb" ]]; then cp "$deb" "$vendor_dir/"; found=$((found + 1)); fi
|
|
|
|
|
+ done
|
|
|
|
|
+ if [[ $found -eq 2 ]]; then
|
|
|
|
|
+ log_info "Pinning db client ${DB_CLIENT_VERSION} from ${DEB_REPO_DIR}/dist"
|
|
|
|
|
+ else
|
|
|
|
|
+ log_warn "db client ${DB_CLIENT_VERSION} not found locally; the image will try the apt repo"
|
|
|
|
|
+ fi
|
|
|
|
|
+
|
|
|
local base_cache_args=()
|
|
local base_cache_args=()
|
|
|
if [[ $NO_CACHE -eq 1 ]]; then
|
|
if [[ $NO_CACHE -eq 1 ]]; then
|
|
|
base_cache_args+=("--no-cache")
|
|
base_cache_args+=("--no-cache")
|
|
@@ -273,6 +296,7 @@ build_docker() {
|
|
|
-t "$BASE_IMAGE_NAME" \
|
|
-t "$BASE_IMAGE_NAME" \
|
|
|
--build-arg "REPO_USER=${REPO_USER}" \
|
|
--build-arg "REPO_USER=${REPO_USER}" \
|
|
|
--build-arg "REPO_PASS=${REPO_PASS}" \
|
|
--build-arg "REPO_PASS=${REPO_PASS}" \
|
|
|
|
|
+ --build-arg "DB_CLIENT_VERSION=${DB_CLIENT_VERSION}" \
|
|
|
"${base_cache_args[@]+"${base_cache_args[@]}"}" \
|
|
"${base_cache_args[@]+"${base_cache_args[@]}"}" \
|
|
|
"$PROJECT_DIR"
|
|
"$PROJECT_DIR"
|
|
|
log_success "Base image built: ${BASE_IMAGE_NAME}"
|
|
log_success "Base image built: ${BASE_IMAGE_NAME}"
|