Skip to content

Commit

Permalink
Merge pull request #1097 from crazy-max/dockerfile-test-stage
Browse files Browse the repository at this point in the history
dockerfile: enhance test stage
  • Loading branch information
tonistiigi authored May 13, 2022
2 parents 69824a5 + cc90c5c commit 908ce2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ FROM golatest AS gobase
COPY --from=xx / /
RUN apk add --no-cache file git
ENV GOFLAGS=-mod=vendor
ENV CGO_ENABLED=0
WORKDIR /src

FROM gobase AS buildx-version
Expand All @@ -23,7 +24,6 @@ RUN --mount=target=. \
echo -n "${VERSION}" | tee /tmp/.version;

FROM gobase AS buildx-build
ENV CGO_ENABLED=0
ARG LDFLAGS="-w -s"
ARG TARGETPLATFORM
RUN --mount=type=bind,target=. \
Expand All @@ -33,7 +33,7 @@ RUN --mount=type=bind,target=. \
set -x; xx-go build -ldflags "$(cat /tmp/.ldflags) ${LDFLAGS}" -o /usr/bin/buildx ./cmd/buildx && \
xx-verify --static /usr/bin/buildx

FROM buildx-build AS test
FROM gobase AS test
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
Expand Down

0 comments on commit 908ce2d

Please sign in to comment.