git.iko.soy/typeable/oauth2-proxy
on 2dd4a96 help sign in
32 lines 1.1 kB history raw
1FROM golang:1.16-buster AS builder
3# Copy sources
4WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
6# Fetch dependencies
7COPY go.mod go.sum ./
8RUN GO111MODULE=on go mod download
10# Now pull in our code
11COPY . .
13ARG VERSION
15# Build binary and make sure there is at least an empty key file.
16# This is useful for GCP App Engine custom runtime builds, because
17# you cannot use multiline variables in their app.yaml, so you have to
18# build the key into the container and then tell it where it is
19# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
20# in app.yaml instead.
21RUN VERSION=${VERSION} make build && touch jwt_signing_key.pem
23# Copy binary to alpine
24FROM alpine:3.13
25COPY nsswitch.conf /etc/nsswitch.conf
26COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
27COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
28COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
30USER 2000:2000
32ENTRYPOINT ["/bin/oauth2-proxy"]