fix: improve TARGETOS and TARGETARCH variable handling in Dockerfile
This commit is contained in:
+8
-8
@@ -50,19 +50,19 @@ COPY --from=web-builder /src/web/out ./web/out
|
|||||||
RUN --mount=type=cache,target=/go/pkg/mod \
|
RUN --mount=type=cache,target=/go/pkg/mod \
|
||||||
--mount=type=cache,target=/root/.cache/go-build \
|
--mount=type=cache,target=/root/.cache/go-build \
|
||||||
set -eux; \
|
set -eux; \
|
||||||
if [ "$${TARGETOS}" != "linux" ]; then \
|
if [ "${TARGETOS}" != "linux" ]; then \
|
||||||
echo "LanceDB Docker image supports TARGETOS=linux only, got $${TARGETOS}" >&2; \
|
echo "LanceDB Docker image supports TARGETOS=linux only, got ${TARGETOS}" >&2; \
|
||||||
exit 1; \
|
exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
arch="$${TARGETARCH:-$$(go env GOARCH)}"; \
|
arch="${TARGETARCH:-$(go env GOARCH)}"; \
|
||||||
case "$$arch" in \
|
case "$arch" in \
|
||||||
amd64|arm64) ;; \
|
amd64|arm64) ;; \
|
||||||
*) echo "Unsupported LanceDB Docker architecture: $$arch" >&2; exit 1 ;; \
|
*) echo "Unsupported LanceDB Docker architecture: $arch" >&2; exit 1 ;; \
|
||||||
esac; \
|
esac; \
|
||||||
curl -sSL https://raw.githubusercontent.com/lancedb/lancedb-go/main/scripts/download-artifacts.sh | bash -s "$${LANCEDB_VERSION}"; \
|
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_ENABLED=1 GOOS="${TARGETOS}" GOARCH="$arch" \
|
||||||
CGO_CFLAGS="-I/src/include" \
|
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
|
go build -tags lancedb -v -trimpath -ldflags="-s -w" -o /out/agent-desk ./cmd/server
|
||||||
|
|
||||||
FROM debian:bookworm-slim AS app-lancedb
|
FROM debian:bookworm-slim AS app-lancedb
|
||||||
|
|||||||
Reference in New Issue
Block a user