Skip to content

Commit

Permalink
Fix to use multi-stage build
Browse files Browse the repository at this point in the history
  • Loading branch information
knanao committed May 13, 2022
1 parent a65ddc3 commit 722b591
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tool/codegen/Dockerfile
@@ -1,3 +1,12 @@
# Builder image to build go program.
FROM golang:1.17-alpine3.15 as BUILDER

COPY protoc-gen-auth /protoc-gen-auth
RUN cd /protoc-gen-auth \
&& go build -o /usr/local/bin/protoc-gen-auth . \
&& chmod +x /usr/local/bin/protoc-gen-auth

# Codegen image which is actually being used.
FROM golang:1.17-alpine3.15

ENV PROTOC_VER=3.19.4
Expand Down Expand Up @@ -39,10 +48,7 @@ RUN go install github.com/envoyproxy/protoc-gen-validate@v${PROTOC_GEN_VALIDATE_
&& mv /go/src/github.com/envoyproxy/protoc-gen-validate-${PROTOC_GEN_VALIDATE_VER} /go/src/github.com/envoyproxy/protoc-gen-validate

# protoc-gen-auth
COPY protoc-gen-auth /protoc-gen-auth
RUN cd /protoc-gen-auth && \
go build -o /usr/local/bin/protoc-gen-auth . && \
chmod +x /usr/local/bin/protoc-gen-auth
COPY --from=BUILDER /usr/local/bin/protoc-gen-auth /usr/local/bin/

# gomock
RUN go install github.com/golang/mock/mockgen@v${GOMOCK_VER}
Expand Down

0 comments on commit 722b591

Please sign in to comment.