2021-02-17 22:59:46 +02:00
|
|
|
FROM golang:1.16-buster AS builder
|
2019-02-02 01:08:19 +02:00
|
|
|
|
|
|
|
# Copy sources
|
2020-03-29 15:54:36 +02:00
|
|
|
WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
|
2019-02-02 01:08:19 +02:00
|
|
|
|
|
|
|
# Fetch dependencies
|
2019-07-15 22:38:55 +02:00
|
|
|
COPY go.mod go.sum ./
|
2019-07-15 22:49:38 +02:00
|
|
|
RUN GO111MODULE=on go mod download
|
2019-02-02 01:08:19 +02:00
|
|
|
|
2019-07-12 00:18:07 +02:00
|
|
|
# Now pull in our code
|
|
|
|
COPY . .
|
|
|
|
|
2021-03-29 20:08:40 +02:00
|
|
|
ARG VERSION
|
|
|
|
|
2019-03-21 00:15:47 +02:00
|
|
|
# Build binary and make sure there is at least an empty key file.
|
|
|
|
# This is useful for GCP App Engine custom runtime builds, because
|
|
|
|
# you cannot use multiline variables in their app.yaml, so you have to
|
|
|
|
# build the key into the container and then tell it where it is
|
|
|
|
# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
|
|
|
|
# in app.yaml instead.
|
2020-07-07 10:53:32 +02:00
|
|
|
RUN VERSION=${VERSION} GOARCH=arm64 make build && touch jwt_signing_key.pem
|
2019-02-02 01:08:19 +02:00
|
|
|
|
|
|
|
# Copy binary to alpine
|
2021-01-30 17:33:28 +02:00
|
|
|
FROM arm64v8/alpine:3.13
|
2020-02-23 20:16:18 +02:00
|
|
|
COPY nsswitch.conf /etc/nsswitch.conf
|
2019-02-02 03:20:20 +02:00
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
2020-03-29 15:54:36 +02:00
|
|
|
COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
|
|
|
|
COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
|
2019-02-02 01:08:19 +02:00
|
|
|
|
2019-05-03 08:38:03 +02:00
|
|
|
USER 2000:2000
|
2019-03-05 10:26:49 +02:00
|
|
|
|
2020-03-29 15:54:36 +02:00
|
|
|
ENTRYPOINT ["/bin/oauth2-proxy"]
|