Skip to content

Commit 9f256a2

Browse files
committedSep 10, 2020
Use multi-stage build for registry image.
The upstream-registry-builder image is bigger than it needs to be, and about half of its size seems to be coming from unused build artifacts. Putting all of that in a separate builder stage cuts the size of the final image by about half.
1 parent cccf27a commit 9f256a2

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed
 

‎upstream-builder.Dockerfile

+13-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.13-alpine
1+
FROM golang:1.13-alpine as builder
22

33
RUN apk update && apk add sqlite build-base git mercurial bash
44
WORKDIR /build
@@ -12,8 +12,15 @@ RUN make static
1212
RUN GRPC_HEALTH_PROBE_VERSION=v0.3.2 && \
1313
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-$(go env GOARCH) && \
1414
chmod +x /bin/grpc_health_probe
15-
RUN cp /build/bin/opm /bin/opm && \
16-
cp /build/bin/initializer /bin/initializer && \
17-
cp /build/bin/appregistry-server /bin/appregistry-server && \
18-
cp /build/bin/configmap-server /bin/configmap-server && \
19-
cp /build/bin/registry-server /bin/registry-server
15+
16+
FROM golang:1.13-alpine
17+
18+
COPY --from=builder [ \
19+
"/bin/grpc_health_probe", \
20+
"/build/bin/opm", \
21+
"/build/bin/initializer", \
22+
"/build/bin/appregistry-server", \
23+
"/build/bin/configmap-server", \
24+
"/build/bin/registry-server", \
25+
"/bin/" \
26+
]

0 commit comments

Comments
 (0)
Please sign in to comment.