Skip to content

Commit

Permalink
Dockerfile: de-duplicate args
Browse files Browse the repository at this point in the history
When extending a stage, the new stage is considered a
breakpoint, so

    FROM foo AS one
    ARG something

    FROM one AS two
    # ARG is present here as well

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Aug 20, 2022
1 parent acd90ea commit 1ecc554
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ RUN --mount=target=. \

FROM gobase AS base
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
RUN xx-apk add musl-dev gcc libsecret-dev pass

FROM base AS test
Expand All @@ -43,9 +46,6 @@ FROM scratch AS test-coverage
COPY --from=test /tmp/coverage.txt /coverage.txt

FROM base AS build-linux
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
Expand All @@ -59,8 +59,6 @@ RUN --mount=type=bind,target=. \
EOT

FROM base AS build-darwin
ARG TARGETARCH
ARG TARGETVARIANT
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
Expand All @@ -74,8 +72,6 @@ RUN --mount=type=bind,target=. \
EOT

FROM base AS build-windows
ARG TARGETARCH
ARG TARGETVARIANT
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
Expand Down

0 comments on commit 1ecc554

Please sign in to comment.