git.iko.soy/typeable/oauth2-proxy
on remove-gap-headers help sign in
34 lines 1.2 kB history raw
1FROM golang:1.15-buster AS builder
2ARG VERSION
4# Download tools
5RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.24.0
7# Copy sources
8WORKDIR $GOPATH/src/github.com/oauth2-proxy/oauth2-proxy
10# Fetch dependencies
11COPY go.mod go.sum ./
12RUN GO111MODULE=on go mod download
14# Now pull in our code
15COPY . .
17# Build binary and make sure there is at least an empty key file.
18# This is useful for GCP App Engine custom runtime builds, because
19# you cannot use multiline variables in their app.yaml, so you have to
20# build the key into the container and then tell it where it is
21# by setting OAUTH2_PROXY_JWT_KEY_FILE=/etc/ssl/private/jwt_signing_key.pem
22# in app.yaml instead.
23RUN VERSION=${VERSION} make build && touch jwt_signing_key.pem
25# Copy binary to alpine
26FROM alpine:3.11
27COPY nsswitch.conf /etc/nsswitch.conf
28COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
29COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/oauth2-proxy /bin/oauth2-proxy
30COPY --from=builder /go/src/github.com/oauth2-proxy/oauth2-proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
32USER 2000:2000
34ENTRYPOINT ["/bin/oauth2-proxy"]