Skip to content

Commit

Permalink
Fix ordering of copy and go mod in Dockerfile
Browse files Browse the repository at this point in the history
Once the api directory has its own go.mod, which is refered to in the
top go.mod, it needs to be copied before running `go mod download` in
the Dockerfile.

This won't have been picked up in PR testing, because it's only in the
Dockerfile and the docker-build isn't run in the test workflow (maybe
it should be?).

Signed-off-by: Michael Bridgen <michael@weave.works>
  • Loading branch information
squaremo committed Nov 19, 2020
1 parent 8ce7daf commit 463dfe3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ WORKDIR /workspace
COPY go.mod go.mod
COPY go.sum go.sum

# Copy this, which should not change often; and, needs to be in place
# before `go mod download`.
COPY api/ api/

# cache modules
RUN go mod download

# copy source code
COPY main.go main.go
COPY api/ api/
COPY controllers/ controllers/

# build without giving the arch, so that it gets it from the machine
Expand Down

0 comments on commit 463dfe3

Please sign in to comment.