-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
59 lines (51 loc) · 1.8 KB
/
Copy pathDockerfile
File metadata and controls
59 lines (51 loc) · 1.8 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
FROM tecnativa/docker-socket-proxy
LABEL sh.demyx.image demyx/docker-socket-proxy
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 variables
ENV DEMYX /demyx
ENV DEMYX_CONFIG /etc/demyx
ENV DEMYX_LOG /var/log/demyx
ENV TZ America/Los_Angeles
# Support for old variables
ENV DOCKER_SOCKET_PROXY_ROOT /demyx
ENV DOCKER_SOCKET_PROXY_CONFIG /etc/demyx
ENV DOCKER_SOCKET_PROXY_LOG /var/log/demyx
# Packages
RUN set -ex; \
apk --update --no-cache add bash sudo
# 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
# Configure sudo
RUN set -ex; \
echo "demyx ALL=(ALL) NOPASSWD:SETENV: /usr/local/bin/demyx-entrypoint" > /etc/sudoers.d/demyx
# Finalize
RUN set -ex; \
\
# Create entrypoint
/usr/local/bin/docker-entrypoint.sh \
cp /usr/local/etc/haproxy/haproxy.cfg.template /usr/local/etc/haproxy/haproxy.cfg; \
sed -i "s/\${BIND_CONFIG}/:2375/g" /usr/local/etc/haproxy/haproxy.cfg; \
echo "#!/bin/bash" > /usr/local/bin/demyx-entrypoint; \
echo "haproxy -W -db -f /usr/local/etc/haproxy/haproxy.cfg" >> /usr/local/bin/demyx-entrypoint; \
\
chmod +x /usr/local/bin/demyx-entrypoint; \
\
# Lockdown
chmod o-x /bin/busybox
USER demyx
ENTRYPOINT ["sudo", "-E", "demyx-entrypoint"]