-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
70 lines (57 loc) · 1.89 KB
/
Dockerfile
File metadata and controls
70 lines (57 loc) · 1.89 KB
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
FROM golang:alpine3.18 as demyx_go
# Imports
COPY config /build
RUN set -ex; \
cd /build; \
go mod init github.com/demyxsh/traefik; \
go mod tidy; \
go build
FROM traefik
LABEL sh.demyx.image demyx/traefik
LABEL sh.demyx.maintainer Demyx <info@demyx.sh>
LABEL sh.demyx.url https://demyx.sh
LABEL sh.demyx.github https://github.com/demyxsh
LABEL sh.demyx.registry https://hub.docker.com/u/demyx
# Set default environment variables
ENV DEMYX /demyx
ENV DEMYX_CONFIG /etc/demyx
ENV DEMYX_LOG /var/log/demyx
ENV DEMYX_ENDPOINT tcp://demyx_socket:2375
ENV TZ America/Los_Angeles
# Packages
RUN set -ex; \
apk add --no-cache --update bash tzdata
# Configure Demyx
RUN set -ex; \
# Create demyx user
addgroup -g 1000 -S demyx; \
adduser -u 1000 -D -S -G demyx demyx; \
\
# Create demyx directories
install -d -m 0755 -o demyx -g demyx "$DEMYX"; \
install -d -m 0755 -o demyx -g demyx "$DEMYX_CONFIG"; \
install -d -m 0755 -o demyx -g demyx "$DEMYX_LOG"; \
\
# Update .bashrc
echo 'PS1="$(whoami)@\h:\w \$ "' > /home/demyx/.bashrc; \
echo 'PS1="$(whoami)@\h:\w \$ "' > /root/.bashrc
# Imports
COPY --from=demyx_go /build/traefik /usr/local/bin/demyx-entrypoint
# Finalize
RUN set -ex; \
# Keep a local copy of Cloudflare's IPs
DEMYX_IPV4="$(wget -qO- https://www.cloudflare.com/ips-v4 | sed 's/^/ - /')"; \
DEMYX_IPV6="$(wget -qO- https://www.cloudflare.com/ips-v6 | sed 's/^/ - /')"; \
echo "$DEMYX_IPV4" > "$DEMYX_CONFIG"/cf_ips; \
echo "$DEMYX_IPV6" >> "$DEMYX_CONFIG"/cf_ips; \
\
# Link the yaml
mkdir -p /etc/traefik; \
ln -sf "$DEMYX_CONFIG"/traefik.yml /etc/traefik/traefik.yml; \
\
# Lockdown
chmod o-x /bin/busybox
EXPOSE 8080 80 443
USER demyx
WORKDIR "$DEMYX"
ENTRYPOINT ["demyx-entrypoint"]