2021-02-05 07:00:52 +00:00
|
|
|
FROM golang:1.15.8-alpine3.13 AS builder
|
2016-08-09 15:26:32 -07:00
|
|
|
|
2021-01-23 19:13:13 +01:00
|
|
|
WORKDIR /usr/local/src/dex
|
|
|
|
|
|
|
|
RUN apk add --no-cache --update alpine-sdk
|
|
|
|
|
2020-09-28 07:47:39 +10:00
|
|
|
ARG TARGETOS
|
|
|
|
ARG TARGETARCH
|
|
|
|
ARG TARGETVARIANT=""
|
|
|
|
|
2021-01-23 19:13:13 +01:00
|
|
|
ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${TARGETVARIANT}
|
2017-09-18 08:56:39 +02:00
|
|
|
|
2020-11-05 14:26:39 +01:00
|
|
|
ARG GOPROXY
|
|
|
|
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
COPY api/v2/go.mod api/v2/go.sum ./api/v2/
|
|
|
|
RUN go mod download
|
|
|
|
|
2020-09-28 07:47:39 +10:00
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN make release-binary
|
2017-09-18 08:56:39 +02:00
|
|
|
|
2021-01-29 07:04:44 +00:00
|
|
|
FROM alpine:3.13.1
|
2020-09-28 07:47:39 +10:00
|
|
|
|
2016-11-14 17:25:19 -08:00
|
|
|
# Dex connectors, such as GitHub and Google logins require root certificates.
|
|
|
|
# Proper installations should manage those certificates, but it's a bad user
|
|
|
|
# experience when this doesn't work out of the box.
|
|
|
|
#
|
|
|
|
# OpenSSL is required so wget can query HTTPS endpoints for health checking.
|
2020-10-16 19:52:21 +03:00
|
|
|
RUN apk add --no-cache --update ca-certificates openssl
|
2016-08-09 15:26:32 -07:00
|
|
|
|
2021-01-23 18:35:31 +01:00
|
|
|
RUN mkdir -p /var/dex
|
|
|
|
RUN chown -R 1001:1001 /var/dex
|
|
|
|
|
2021-01-23 18:45:12 +01:00
|
|
|
# Copy module files for CVE scanning / dependency analysis.
|
2021-01-23 18:58:04 +01:00
|
|
|
COPY --from=builder /usr/local/src/dex/go.mod /usr/local/src/dex/go.sum /usr/local/src/dex/
|
|
|
|
COPY --from=builder /usr/local/src/dex/api/v2/go.mod /usr/local/src/dex/api/v2/go.sum /usr/local/src/dex/api/v2/
|
2021-01-23 18:45:12 +01:00
|
|
|
|
2021-01-23 18:58:04 +01:00
|
|
|
COPY --from=builder /go/bin/dex /usr/local/bin/dex
|
2016-08-09 15:26:32 -07:00
|
|
|
|
2021-01-23 18:46:56 +01:00
|
|
|
USER 1001:1001
|
|
|
|
|
2016-11-30 14:26:54 -08:00
|
|
|
# Import frontend assets and set the correct CWD directory so the assets
|
|
|
|
# are in the default path.
|
2021-01-24 00:56:53 +01:00
|
|
|
COPY --from=builder /usr/local/src/dex/web /web
|
2016-11-30 14:26:54 -08:00
|
|
|
|
2021-01-23 19:06:24 +01:00
|
|
|
USER 1001:1001
|
|
|
|
|
2016-11-14 17:25:19 -08:00
|
|
|
ENTRYPOINT ["dex"]
|
2016-08-09 15:26:32 -07:00
|
|
|
|
|
|
|
CMD ["version"]
|