2019-04-12 12:15:29 +02:00
|
|
|
FROM golang:1.12-stretch AS builder
|
2019-01-21 19:50:50 +02:00
|
|
|
|
|
|
|
# Download tools
|
|
|
|
RUN wget -O $GOPATH/bin/dep https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64
|
|
|
|
RUN chmod +x $GOPATH/bin/dep
|
|
|
|
|
|
|
|
# Copy sources
|
|
|
|
WORKDIR $GOPATH/src/github.com/pusher/oauth2_proxy
|
2018-12-20 13:06:26 +02:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# Fetch dependencies
|
|
|
|
RUN dep ensure --vendor-only
|
|
|
|
|
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.
|
|
|
|
RUN ./configure && make build && touch jwt_signing_key.pem
|
2018-12-20 13:06:26 +02:00
|
|
|
|
2019-01-21 19:50:50 +02:00
|
|
|
# Copy binary to alpine
|
2019-05-31 08:53:10 +02:00
|
|
|
FROM alpine:3.9
|
2019-02-02 03:20:20 +02:00
|
|
|
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
2018-12-20 13:06:26 +02:00
|
|
|
COPY --from=builder /go/src/github.com/pusher/oauth2_proxy/oauth2_proxy /bin/oauth2_proxy
|
2019-03-21 00:15:47 +02:00
|
|
|
COPY --from=builder /go/src/github.com/pusher/oauth2_proxy/jwt_signing_key.pem /etc/ssl/private/jwt_signing_key.pem
|
2018-12-20 13:06:26 +02:00
|
|
|
|
2019-05-03 08:38:03 +02:00
|
|
|
USER 2000:2000
|
2019-03-05 10:26:49 +02:00
|
|
|
|
2018-12-20 13:06:26 +02:00
|
|
|
ENTRYPOINT ["/bin/oauth2_proxy"]
|