From 5221ae820133993cc7b2016b78df1bcb896ee20a Mon Sep 17 00:00:00 2001 From: mlogclub Date: Sun, 7 Jun 2026 21:00:57 +0800 Subject: [PATCH] fix: improve TARGETOS and TARGETARCH variable handling in Dockerfile --- Dockerfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 750eb5d..1385c9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,19 +50,19 @@ COPY --from=web-builder /src/web/out ./web/out RUN --mount=type=cache,target=/go/pkg/mod \ --mount=type=cache,target=/root/.cache/go-build \ set -eux; \ - if [ "$${TARGETOS}" != "linux" ]; then \ - echo "LanceDB Docker image supports TARGETOS=linux only, got $${TARGETOS}" >&2; \ + if [ "${TARGETOS}" != "linux" ]; then \ + echo "LanceDB Docker image supports TARGETOS=linux only, got ${TARGETOS}" >&2; \ exit 1; \ fi; \ - arch="$${TARGETARCH:-$$(go env GOARCH)}"; \ - case "$$arch" in \ + arch="${TARGETARCH:-$(go env GOARCH)}"; \ + case "$arch" in \ amd64|arm64) ;; \ - *) echo "Unsupported LanceDB Docker architecture: $$arch" >&2; exit 1 ;; \ + *) echo "Unsupported LanceDB Docker architecture: $arch" >&2; exit 1 ;; \ esac; \ - curl -sSL https://raw.githubusercontent.com/lancedb/lancedb-go/main/scripts/download-artifacts.sh | bash -s "$${LANCEDB_VERSION}"; \ - CGO_ENABLED=1 GOOS="$${TARGETOS}" GOARCH="$$arch" \ + curl -sSL https://raw.githubusercontent.com/lancedb/lancedb-go/main/scripts/download-artifacts.sh | bash -s "${LANCEDB_VERSION}"; \ + CGO_ENABLED=1 GOOS="${TARGETOS}" GOARCH="$arch" \ CGO_CFLAGS="-I/src/include" \ - CGO_LDFLAGS="/src/lib/linux_$$arch/liblancedb_go.a -lm -ldl -lpthread" \ + CGO_LDFLAGS="/src/lib/linux_$arch/liblancedb_go.a -lm -ldl -lpthread" \ go build -tags lancedb -v -trimpath -ldflags="-s -w" -o /out/agent-desk ./cmd/server FROM debian:bookworm-slim AS app-lancedb