Skip to content

Commit 54f9459

Browse files
siddontangzz-jason
authored andcommitted
docker: cache vendor to speed up docker build (#10296)
1 parent 54899f6 commit 54f9459

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

Dockerfile

+10-3
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ RUN apk add --no-cache \
1111
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64 \
1212
&& chmod +x /usr/local/bin/dumb-init
1313

14-
COPY . /go/src/github.com/pingcap/tidb
14+
RUN mkdir -p /go/src/github.com/pingcap/tidb
15+
WORKDIR /go/src/github.com/pingcap/tidb
1516

16-
WORKDIR /go/src/github.com/pingcap/tidb/
17+
# Cache dependencies
18+
COPY go.mod .
19+
COPY go.sum .
1720

21+
RUN GO111MODULE=on go mod download
22+
23+
# Build real binaries
24+
COPY . .
1825
RUN make
1926

2027
# Executable image
@@ -27,4 +34,4 @@ WORKDIR /
2734

2835
EXPOSE 4000
2936

30-
ENTRYPOINT ["/usr/local/bin/dumb-init", "/tidb-server"]
37+
ENTRYPOINT ["/usr/local/bin/dumb-init", "/tidb-server"]

0 commit comments

Comments
 (0)