1# The image ARGs have to be at the top, otherwise the docker daemon cannot validate
2# the FROM statements and overall Dockerfile
4# Argument for setting the build image
5ARG BUILD_IMAGE=placeholder
6# Argument for setting the runtime image
7ARG RUNTIME_IMAGE=placeholder
8# Argument for setting the oauth2-proxy build version
11# All builds should be done using the platform native to the build node to allow
12# cache sharing of the go mod download step.
13# Go cross compilation is also faster than emulation the go compilation across
15FROM --platform=${BUILDPLATFORM} ${BUILD_IMAGE} AS builder
18WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
27# Arguments go here so that the previous steps can be cached if no external sources
28# have changed. These arguments are automatically set by the docker engine.
32# Reload version argument
35# Build binary and make sure there is at least an empty key file.
36# This is useful for GCP App Engine custom runtime builds, because
37# you cannot use multiline variables in their app.yaml, so you have to
38# build the key into the container and then tell it where it is
39# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
41# Set the cross compilation arguments based on the TARGETPLATFORM which is
42# automatically set by the docker engine.
43RUN case ${TARGETPLATFORM} in \
44 "linux/amd64") GOARCH=amd64 ;; \
45 # arm64 and arm64v8 are equivalent in go and do not require a goarm
46 # https://github.com/golang/go/wiki/GoArm
47 "linux/arm64" | "linux/arm/v8") GOARCH=arm64 ;; \
48 "linux/ppc64le") GOARCH=ppc64le ;; \
49 "linux/s390x") GOARCH=s390x ;; \
50 "linux/arm/v6") GOARCH=arm GOARM=6 ;; \
51 "linux/arm/v7") GOARCH=arm GOARM=7 ;; \
53 printf "Building OAuth2 Proxy for arch ${GOARCH}\n" && \
54 GOARCH=${GOARCH} VERSION=${VERSION} make build && touch jwt_signing_key.pem
58# Copy binary to runtime image
63COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
64COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
66LABEL org.opencontainers.image.licenses=MIT \
67 org.opencontainers.image.description="A reverse proxy that provides authentication with Google, Azure, OpenID Connect and many more identity providers." \
68 org.opencontainers.image.documentation=https://oauth2-proxy.github.io/oauth2-proxy/ \
69 org.opencontainers.image.source=https://github.com/oauth2-proxy/oauth2-proxy \
70 org.opencontainers.image.url=https://quay.io/oauth2-proxy/oauth2-proxy \
71 org.opencontainers.image.title=oauth2-proxy \
72 org.opencontainers.image.version=${VERSION}
74ENTRYPOINT ["/bin/oauth2-proxy"]
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list