@@ -1,3 +1,6 @@
1+# This ARG has to be at the top, otherwise the docker daemon does not known what to do with FROM ${RUNTIME_IMAGE}
2+ARG RUNTIME_IMAGE=alpine:3.15
1# All builds should be done using the platform native to the build node to allow
4# All builds should be done using the platform native to the build node to allow
2# cache sharing of the go mod download step.
5# cache sharing of the go mod download step.
3# Go cross compilation is also faster than emulation the go compilation across
6# Go cross compilation is also faster than emulation the go compilation across
@@ -38,12 +41,12 @@ RUN case ${TARGETPLATFORM} in \
38 GOARCH=${GOARCH} VERSION=${VERSION} make build && touch jwt_signing_key.pem
41 GOARCH=${GOARCH} VERSION=${VERSION} make build && touch jwt_signing_key.pem
40# Copy binary to alpine
43# Copy binary to alpine
41−FROM alpine:3.15
44+FROM ${RUNTIME_IMAGE}
42COPY nsswitch.conf /etc/nsswitch.conf
45COPY nsswitch.conf /etc/nsswitch.conf
43−COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
44COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
46COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
45COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
47COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
47−USER 2000:2000
49+# UID/GID 65532 is also known as nonroot user in distroless image
49ENTRYPOINT ["/bin/oauth2-proxy"]
52ENTRYPOINT ["/bin/oauth2-proxy"]