Skip to content

Commit 9364adc

Browse files
feat(build): reduce docker image size
1 parent 80fdd5a commit 9364adc

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

Dockerfile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
FROM golang:1.11-alpine as build
1+
FROM golang:1.11-alpine as builder
22

33
# Install tools required for project
44
# Run `docker build --no-cache .` to update dependencies
55
RUN apk add --no-cache build-base git
66
WORKDIR /arc
77

88
# List project dependencies with go.mod and go.sum
9-
COPY go.mod .
10-
COPY go.sum .
9+
COPY go.mod go.sum ./
1110

1211
# Install library dependencies
1312
RUN go mod download
@@ -17,5 +16,12 @@ RUN go mod download
1716
COPY . .
1817
RUN make
1918

19+
# Final stage: Create the running container
20+
FROM alpine:3.10.1 AS final
21+
22+
# Import the compiled executable from the first stage.
23+
COPY --from=builder /arc /arc
24+
WORKDIR /arc
25+
2026
EXPOSE 8000
2127
CMD ["build/arc", "--log", "stdout", "--plugins"]

0 commit comments

Comments
 (0)