Skip to content

Commit 01e363e

Browse files
Merge pull request #298 from kevinrizza/bug-1820438
Bug 1820438: Slim down upstream builder
2 parents 2bdcd07 + e79673d commit 01e363e

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

upstream-builder.Dockerfile

Lines changed: 9 additions & 6 deletions
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,11 @@ RUN make static
1212
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
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 scratch
17+
COPY --from=builder /build/bin/opm /bin/opm
18+
COPY --from=builder /build/bin/initializer /bin/initializer
19+
COPY --from=builder /build/bin/appregistry-server /bin/appregistry-server
20+
COPY --from=builder /build/bin/configmap-server /bin/configmap-server
21+
COPY --from=builder /build/bin/registry-server /bin/registry-server
22+
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe

upstream-opm-builder.Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM golang:1.13-alpine AS builder
2+
3+
RUN apk update && apk add sqlite build-base git mercurial bash
4+
WORKDIR /build
5+
6+
COPY vendor vendor
7+
COPY cmd cmd
8+
COPY pkg pkg
9+
COPY Makefile Makefile
10+
COPY go.mod go.mod
11+
RUN make static
12+
RUN GRPC_HEALTH_PROBE_VERSION=v0.2.1 && \
13+
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) && \
14+
chmod +x /bin/grpc_health_probe
15+
16+
FROM scratch
17+
COPY --from=builder /build/bin/opm /bin/opm
18+
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe

0 commit comments

Comments
 (0)