Skip to content

Commit 24d8e4f

Browse files
committed
update resource url
Signed-off-by: 沈冬冬 <[email protected]>
1 parent 492ba0e commit 24d8e4f

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

Dockerfile-muiti-architecture

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM golang:1.16.6-alpine3.13 AS builder
2+
3+
WORKDIR /usr/local/src/dex
4+
5+
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
6+
RUN apk add --no-cache --update alpine-sdk
7+
8+
ARG TARGETOS
9+
ARG TARGETARCH
10+
ARG TARGETVARIANT=""
11+
12+
ENV GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOARM=${TARGETVARIANT}
13+
ENV GOPROXY=https://goproxy.cn,direct
14+
15+
COPY go.mod go.sum ./
16+
COPY api/v2/go.mod api/v2/go.sum ./api/v2/
17+
RUN go mod download
18+
19+
COPY . .
20+
21+
RUN make release-binary
22+
23+
FROM alpine:3.14.0 AS gomplate
24+
25+
ARG TARGETOS
26+
ARG TARGETARCH
27+
ARG TARGETVARIANT
28+
29+
ENV GOMPLATE_VERSION=v3.9.0
30+
31+
RUN wget -O /usr/local/bin/gomplate-amd64 "https://resource.koderover.com/gomplate_linux-amd64" \
32+
&& chmod +x /usr/local/bin/gomplate-amd64
33+
34+
RUN wget -O /usr/local/bin/gomplate-arm64 "https://resource.koderover.com/gomplate_linux-arm64" \
35+
&& chmod +x /usr/local/bin/gomplate-arm64
36+
37+
FROM alpine:3.14.0
38+
39+
ARG TARGETARCH
40+
41+
# Dex connectors, such as GitHub and Google logins require root certificates.
42+
# Proper installations should manage those certificates, but it's a bad user
43+
# experience when this doesn't work out of the box.
44+
#
45+
# OpenSSL is required so wget can query HTTPS endpoints for health checking.
46+
RUN apk add --no-cache --update ca-certificates openssl
47+
48+
RUN mkdir -p /var/dex
49+
RUN chown -R 1001:1001 /var/dex
50+
51+
RUN mkdir -p /etc/dex
52+
COPY config.docker.yaml /etc/dex/
53+
RUN chown -R 1001:1001 /etc/dex
54+
55+
# Copy module files for CVE scanning / dependency analysis.
56+
COPY --from=builder /usr/local/src/dex/go.mod /usr/local/src/dex/go.sum /usr/local/src/dex/
57+
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/
58+
59+
COPY --from=builder /go/bin/dex /usr/local/bin/dex
60+
COPY --from=builder /usr/local/src/dex/web /srv/dex/web
61+
62+
COPY --from=gomplate /usr/local/bin/gomplate-${TARGETARCH} /usr/local/bin/gomplate
63+
64+
USER 1001:1001
65+
66+
COPY docker-entrypoint.sh /entrypoint.sh
67+
68+
ENV DEX_FRONTEND_DIR=/srv/dex/custom-web
69+
70+
COPY --chown=root:root custom-web /srv/dex/custom-web
71+
72+
ENTRYPOINT ["/entrypoint.sh"]
73+
CMD ["dex", "serve", "/etc/dex/config.docker.yaml"]

0 commit comments

Comments
 (0)