Skip to content

Commit

Permalink
Dockerfile: fix duplicate WORKDIR, and source COPY for update-modules…
Browse files Browse the repository at this point in the history
… stage

I noticed that building the "vendor" target was copying the source twice;
once in the "build-base" stage, and once in the "update-modules" stage:

    docker buildx bake --set vendor.args.MODULE=github.com/docker/cli vendor
    ...
    => [build-base 1/3] COPY --from=hugo /go/bin/hugo /bin/hugo                 0.2s
    => [build-base 2/3] COPY --from=node /src/node_modules /src/node_modules    1.6s
    => [build-base 3/3] COPY . .                                                3.1s
    => [update-modules 1/4] WORKDIR /src                                        0.0s
    => [update-modules 2/4] COPY . .                                            5.0s
    => [update-modules 3/4] RUN hugo mod get -u                                14.1s
    => [update-modules 4/4] RUN hugo mod vendor                                17.3s

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Dec 11, 2023
1 parent d3bb158 commit 6728abc
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ RUN htmltest

FROM build-base as update-modules
ARG MODULE="-u"
WORKDIR /src
COPY . .
RUN hugo mod get ${MODULE}
RUN hugo mod vendor

Expand Down

0 comments on commit 6728abc

Please sign in to comment.