-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile
57 lines (55 loc) · 2.63 KB
/
Dockerfile
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
ARG TRAEFIK_IMAGE
## Install plugins from source repositories:
FROM alpine:3 AS plugins
ARG BLOCKPATH_MODULE
ARG BLOCKPATH_GIT_BRANCH
ARG REFERER_MODULE
ARG REFERER_GIT_BRANCH
ARG MAXMIND_GEOIP_MODULE
ARG MAXMIND_GIT_BRANCH
ARG HEADER_AUTHORIZATION_MODULE
ARG HEADER_AUTHORIZATION_GIT_BRANCH
ARG CERT_AUTH_MODULE
ARG CERT_AUTH_GIT_BRANCH
ARG MTLS_HEADER_MODULE
ARG MTLS_HEADER_GIT_BRANCH
RUN apk add --update git && \
git clone https://${BLOCKPATH_MODULE}.git /plugins-local/src/github.com/traefik/plugin-blockpath \
--depth 1 --single-branch --branch ${BLOCKPATH_GIT_BRANCH}
RUN git clone https://${MAXMIND_GEOIP_MODULE}.git \
/plugins-local/src/github.com/forestvpn/traefikgeoip2 \
--depth 1 --single-branch --branch ${MAXMIND_GIT_BRANCH}
RUN git clone https://${REFERER_MODULE}.git /plugins-local/src/github.com/moonlightwatch/referer \
--depth 1 --single-branch --branch ${REFERER_GIT_BRANCH}
RUN git clone https://${HEADER_AUTHORIZATION_MODULE}.git /plugins-local/src/github.com/poloyacero/headauth \
--depth 1 --single-branch --branch ${HEADER_AUTHORIZATION_GIT_BRANCH}
RUN git clone https://${CERT_AUTH_MODULE}.git /plugins-local/src/github.com/famedly/traefik-certauthz \
--depth 1 --single-branch --branch ${CERT_AUTH_GIT_BRANCH}
RUN git clone https://${MTLS_HEADER_MODULE}.git /plugins-local/src/github.com/pnxs/traefik-plugin-mtls-header \
--depth 1 --single-branch --branch ${MTLS_HEADER_GIT_BRANCH}
FROM ${TRAEFIK_IMAGE}
ARG TRAEFIK_UID TRAEFIK_GID TRAEFIK_DOCKER_GID
COPY --from=plugins /plugins-local /plugins-local
COPY entrypoint.sh /entrypoint_ensure_config.sh
RUN apk --no-cache add curl jq libcap step-cli && \
chmod a+x /entrypoint_ensure_config.sh && \
addgroup -g ${TRAEFIK_GID} traefik && \
getent group ${TRAEFIK_DOCKER_GID} || addgroup -g ${TRAEFIK_DOCKER_GID} docker && \
adduser traefik -D -u ${TRAEFIK_UID} -G traefik && \
addgroup traefik $(getent group ${TRAEFIK_DOCKER_GID} | cut -d: -f1) && \
mkdir /data && \
chown traefik:traefik /data && \
setcap cap_net_bind_service=+ep /usr/local/bin/traefik
ARG STEP_CA_ENABLED STEP_CA_ENDPOINT STEP_CA_FINGERPRINT
RUN test "${STEP_CA_ENABLED}" != "true" && exit || \
step ca bootstrap --ca-url "${STEP_CA_ENDPOINT}" --install --force --fingerprint "${STEP_CA_FINGERPRINT}" && \
step ca roots > /step_ca_root.crt && \
chmod 0444 /step_ca_root.crt
ARG STEP_CA_ZERO_CERTS
RUN test "${STEP_CA_ZERO_CERTS}" != "true" && exit || \
rm -f /etc/ssl/certs/* && \
ln -s /step_ca_root.crt /etc/ssl/certs/ca-certificates.crt && \
chmod uog-w /etc/ssl/certs
USER traefik
ENTRYPOINT ["/entrypoint_ensure_config.sh"]
VOLUME /data