forked from dexidp/dex
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile-muiti-architecture
75 lines (54 loc) · 2.13 KB
/
Dockerfile-muiti-architecture
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FROM golang:1.16.6-alpine3.13 AS builder
WORKDIR /usr/local/src/dex
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
RUN apk add --no-cache --update alpine-sdk
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT=""
ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${TARGETVARIANT}
ENV GOPROXY=https://goproxy.cn,direct
ENV GOCACHE=/gocache
COPY go.mod go.sum ./
COPY api/v2/go.mod api/v2/go.sum ./api/v2/
RUN go mod download
COPY . .
RUN --mount=type=cache,id=gobuild,target=/gocache make release-binary
#FROM alpine:3.14.0 AS gomplate
#
#ARG TARGETOS
#ARG TARGETARCH
#ARG TARGETVARIANT
#
#ENV GOMPLATE_VERSION=v3.9.0
#
#RUN wget -O /usr/local/bin/gomplate-amd64 "https://resource.koderover.com/gomplate_linux-amd64" \
# && chmod +x /usr/local/bin/gomplate-amd64
#
#RUN wget -O /usr/local/bin/gomplate-arm64 "https://resource.koderover.com/gomplate_linux-arm64" \
# && chmod +x /usr/local/bin/gomplate-arm64
FROM alpine:3.14.0
ARG TARGETARCH
# 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.
RUN apk add --no-cache --update ca-certificates openssl
RUN mkdir -p /var/dex
RUN chown -R 1001:1001 /var/dex
RUN mkdir -p /etc/dex
COPY config.docker.yaml /etc/dex/
RUN chown -R 1001:1001 /etc/dex
# Copy module files for CVE scanning / dependency analysis.
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/
COPY --from=builder /go/bin/dex /usr/local/bin/dex
COPY --from=builder /usr/local/src/dex/web /srv/dex/web
COPY bins/gomplate-${TARGETARCH} /usr/local/bin/gomplate
RUN chmod +x /usr/local/bin/gomplate
USER 1001:1001
COPY docker-entrypoint.sh /entrypoint.sh
ENV DEX_FRONTEND_DIR=/srv/dex/custom-web
COPY --chown=root:root custom-web /srv/dex/custom-web
ENTRYPOINT ["/entrypoint.sh"]
CMD ["dex", "serve", "/etc/dex/config.docker.yaml"]