From a642839b84b43f59f137b3e6f89d0c1915b6714f Mon Sep 17 00:00:00 2001 From: "Donlan, Christopher" Date: Mon, 16 Dec 2024 15:36:56 -0500 Subject: [PATCH] [adjust-arch-w-build-args] adjusted scope of args --- Dockerfile | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 36c5627323b..9fde2b5bc5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,16 +3,18 @@ ARG VERSION=dev ARG BUILD_REPO=golang ARG BUILD_TAG=1.22.6-alpine3.20 -ARG BUILD_PACKAGES=build-base ca-certificates +ARG BUILD_PACKAGES="build-base ca-certificates" ARG IMAGE_REPO=alpine ARG IMAGE_TAG=3.18 ARG IMAGE_PACKAGES=ca-certificates -ARG ADD_PACKAGES=apk add -U --no-cache +ARG ADD_PACKAGES="apk add -U --no-cache" FROM --platform=$BUILDPLATFORM $BUILD_REPO:$BUILD_TAG AS build +ARG ADD_PACKAGES BUILD_PACKAGES + WORKDIR /build RUN $ADD_PACKAGES $BUILD_PACKAGES COPY go.mod go.sum ./ @@ -20,20 +22,21 @@ RUN --mount=type=cache,target=/go/pkg go mod download COPY . ./ FROM build AS build-lakefs -ARG VERSION TARGETOS TARGETARCH +ARG VERSION TARGETOS TARGETARCH ADD_PACKAGES BUILD_PACKAGES RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg \ GOOS=$TARGETOS GOARCH=$TARGETARCH \ go build -ldflags "-X github.com/treeverse/lakefs/pkg/version.Version=${VERSION}" -o lakefs ./cmd/lakefs FROM build AS build-lakectl -ARG VERSION TARGETOS TARGETARCH +ARG VERSION TARGETOS TARGETARCH ADD_PACKAGES BUILD_PACKAGES RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg \ GOOS=$TARGETOS GOARCH=$TARGETARCH \ go build -ldflags "-X github.com/treeverse/lakefs/pkg/version.Version=${VERSION}" -o lakectl ./cmd/lakectl FROM $IMAGE_REPO:$IMAGE_TAG AS lakectl +ARG ADD_PACKAGES IMAGE_PACKAGES WORKDIR /app ENV PATH=/app:$PATH COPY --from=build-lakectl /build/lakectl /app/