mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
Dockerfile: merge build stages
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
+20
-36
@@ -4,7 +4,7 @@ ARG GO_VERSION=1.24.7
|
|||||||
ARG DEBIAN_VERSION=bookworm
|
ARG DEBIAN_VERSION=bookworm
|
||||||
|
|
||||||
ARG XX_VERSION=1.7.0
|
ARG XX_VERSION=1.7.0
|
||||||
ARG OSXCROSS_VERSION=11.3-r7-debian
|
ARG OSXCROSS_VERSION=11.3-r8-debian
|
||||||
ARG GOLANGCI_LINT_VERSION=v2.5
|
ARG GOLANGCI_LINT_VERSION=v2.5
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
@@ -99,21 +99,7 @@ FROM gobase AS version
|
|||||||
RUN --mount=target=. \
|
RUN --mount=target=. \
|
||||||
echo -n "$(./hack/git-meta version)" | tee /tmp/.version ; echo -n "$(./hack/git-meta revision)" | tee /tmp/.revision
|
echo -n "$(./hack/git-meta version)" | tee /tmp/.version ; echo -n "$(./hack/git-meta revision)" | tee /tmp/.revision
|
||||||
|
|
||||||
FROM base AS build-linux
|
FROM base AS build
|
||||||
ARG PACKAGE
|
|
||||||
RUN --mount=type=bind,target=. \
|
|
||||||
--mount=type=cache,target=/root/.cache \
|
|
||||||
--mount=type=cache,target=/go/pkg/mod \
|
|
||||||
--mount=type=bind,source=/tmp/.version,target=/tmp/.version,from=version \
|
|
||||||
--mount=type=bind,source=/tmp/.revision,target=/tmp/.revision,from=version <<EOT
|
|
||||||
set -ex
|
|
||||||
xx-go --wrap
|
|
||||||
make build-pass build-secretservice PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
|
||||||
xx-verify /out/docker-credential-pass
|
|
||||||
xx-verify /out/docker-credential-secretservice
|
|
||||||
EOT
|
|
||||||
|
|
||||||
FROM base AS build-darwin
|
|
||||||
ARG PACKAGE
|
ARG PACKAGE
|
||||||
RUN --mount=type=bind,target=. \
|
RUN --mount=type=bind,target=. \
|
||||||
--mount=type=cache,target=/root/.cache \
|
--mount=type=cache,target=/root/.cache \
|
||||||
@@ -124,28 +110,26 @@ RUN --mount=type=bind,target=. \
|
|||||||
set -ex
|
set -ex
|
||||||
export MACOSX_VERSION_MIN=$(make print-MACOSX_DEPLOYMENT_TARGET)
|
export MACOSX_VERSION_MIN=$(make print-MACOSX_DEPLOYMENT_TARGET)
|
||||||
xx-go --wrap
|
xx-go --wrap
|
||||||
go install std
|
case "$(xx-info os)" in
|
||||||
make build-osxkeychain build-pass PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
linux)
|
||||||
xx-verify /out/docker-credential-osxkeychain
|
make build-pass build-secretservice PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
||||||
xx-verify /out/docker-credential-pass
|
xx-verify /out/docker-credential-pass
|
||||||
|
xx-verify /out/docker-credential-secretservice
|
||||||
|
;;
|
||||||
|
darwin)
|
||||||
|
go install std
|
||||||
|
make build-osxkeychain build-pass PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
||||||
|
xx-verify /out/docker-credential-osxkeychain
|
||||||
|
xx-verify /out/docker-credential-pass
|
||||||
|
;;
|
||||||
|
windows)
|
||||||
|
make build-wincred PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
||||||
|
mv /out/docker-credential-wincred /out/docker-credential-wincred.exe
|
||||||
|
xx-verify /out/docker-credential-wincred.exe
|
||||||
|
;;
|
||||||
|
esac
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
FROM base AS build-windows
|
|
||||||
ARG PACKAGE
|
|
||||||
RUN --mount=type=bind,target=. \
|
|
||||||
--mount=type=cache,target=/root/.cache \
|
|
||||||
--mount=type=cache,target=/go/pkg/mod \
|
|
||||||
--mount=type=bind,source=/tmp/.version,target=/tmp/.version,from=version \
|
|
||||||
--mount=type=bind,source=/tmp/.revision,target=/tmp/.revision,from=version <<EOT
|
|
||||||
set -ex
|
|
||||||
xx-go --wrap
|
|
||||||
make build-wincred PACKAGE=$PACKAGE VERSION=$(cat /tmp/.version) REVISION=$(cat /tmp/.revision) DESTDIR=/out
|
|
||||||
mv /out/docker-credential-wincred /out/docker-credential-wincred.exe
|
|
||||||
xx-verify /out/docker-credential-wincred.exe
|
|
||||||
EOT
|
|
||||||
|
|
||||||
FROM build-$TARGETOS AS build
|
|
||||||
|
|
||||||
FROM scratch AS binaries
|
FROM scratch AS binaries
|
||||||
COPY --from=build /out /
|
COPY --from=build /out /
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user