@@ -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
3+
14# All builds should be done using the platform native to the build node to allow
25# cache sharing of the go mod download step.
36# Go cross compilation is also faster than emulation the go compilation across
@@ -38,12 +41,12 @@ RUN case ${TARGETPLATFORM} in \
3841 GOARCH=${GOARCH} VERSION=${VERSION} make build && touch jwt_signing_key.pem
3942
4043# Copy binary to alpine
41−FROM alpine:3.15
44+FROM ${RUNTIME_IMAGE}
4245COPY nsswitch.conf /etc/nsswitch.conf
43−COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
4446COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
4547COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
4648
47−USER 2000:2000
49+# UID/GID 65532 is also known as nonroot user in distroless image
50+USER 65532:65532
4851
4952ENTRYPOINT ["/bin/oauth2-proxy"]