mirror of
https://github.com/status-im/consul.git
synced 2025-02-23 02:48:19 +00:00
allow 'make dev-docker' to cache resolved modules (#5588)
This commit is contained in:
parent
27446a19e2
commit
d8c19a9701
@ -7,10 +7,26 @@ ARG GIT_DESCRIBE
|
|||||||
# WORKDIR /go/src/github.com/hashicorp/consul
|
# WORKDIR /go/src/github.com/hashicorp/consul
|
||||||
ENV CONSUL_DEV=1
|
ENV CONSUL_DEV=1
|
||||||
ENV COLORIZE=0
|
ENV COLORIZE=0
|
||||||
Add . /go/src/github.com/hashicorp/consul/
|
|
||||||
RUN make dev
|
|
||||||
|
|
||||||
|
# Cache modules separately from more frequently edited source files.
|
||||||
|
#
|
||||||
|
# The trick is taken from [https://medium.com/@pliutau/docker-and-go-modules-4265894f9fc#6622]
|
||||||
|
#
|
||||||
|
# We copy the modules files in first since they are less likely to change frequently
|
||||||
|
# and the population of the go mod cache will be invalidated less frequently.
|
||||||
|
COPY go.mod .
|
||||||
|
COPY go.sum .
|
||||||
|
RUN mkdir -p api sdk
|
||||||
|
COPY api/go.mod api
|
||||||
|
COPY api/go.sum api
|
||||||
|
COPY sdk/go.mod sdk
|
||||||
|
COPY sdk/go.sum sdk
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
# Add the rest of the code.
|
||||||
|
ADD . /consul/
|
||||||
|
RUN make dev
|
||||||
|
|
||||||
FROM consul:latest
|
FROM consul:latest
|
||||||
|
|
||||||
COPY --from=builder /go/src/github.com/hashicorp/consul/bin/consul /bin
|
COPY --from=builder /go/bin/consul /bin
|
||||||
|
Loading…
x
Reference in New Issue
Block a user