-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile.debian
139 lines (112 loc) · 2.97 KB
/
Dockerfile.debian
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# vi: ft=dockerfile
FROM nginx:stable
MAINTAINER "cytopia" <cytopia@everythingcli.org>
LABEL \
name="cytopia's nginx stable image" \
image="devilbox/nginx-stable" \
vendor="devilbox" \
license="MIT"
###
### Build arguments
###
ARG VHOST_GEN_GIT_REF=1.0.10
ARG WATCHERD_GIT_REF=v1.1.0
ARG CERT_GEN_GIT_REF=0.10
ENV BUILD_DEPS \
make \
wget
ENV RUN_DEPS \
ca-certificates \
python3-yaml \
supervisor
###
### Install required packages
###
RUN set -eux \
&& apt-get update \
&& apt-get install --no-install-recommends --no-install-suggests -y \
${BUILD_DEPS} \
${RUN_DEPS} \
\
# Install vhost-gen
&& wget --no-check-certificate -O vhost-gen.tar.gz "https://github.com/devilbox/vhost-gen/archive/${VHOST_GEN_GIT_REF}.tar.gz" \
&& tar xvfz vhost-gen.tar.gz \
&& cd "vhost-gen-${VHOST_GEN_GIT_REF}" \
&& make install \
&& cd .. \
&& rm -rf vhost*gen* \
\
# Install cert-gen
&& wget --no-check-certificate -O /usr/bin/ca-gen https://raw.githubusercontent.com/devilbox/cert-gen/${CERT_GEN_GIT_REF}/bin/ca-gen \
&& wget --no-check-certificate -O /usr/bin/cert-gen https://raw.githubusercontent.com/devilbox/cert-gen/${CERT_GEN_GIT_REF}/bin/cert-gen \
&& chmod +x /usr/bin/ca-gen \
&& chmod +x /usr/bin/cert-gen \
\
# Install watcherd
&& wget --no-check-certificate -O /usr/bin/watcherd https://raw.githubusercontent.com/devilbox/watcherd/${WATCHERD_GIT_REF}/bin/watcherd \
&& chmod +x /usr/bin/watcherd \
\
# Clean-up
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
${BUILD_DEPS} \
&& rm -rf /var/lib/apt/lists/*
###
### Runtime arguments
###
ENV MY_USER=nginx
ENV MY_GROUP=nginx
ENV HTTPD_START="/usr/sbin/nginx"
ENV HTTPD_RELOAD="nginx -s reload"
ENV HTTPD_VERSION="nginx -V 2>&1 | head -1 | awk '{print \$3}'"
ENV VHOSTGEN_HTTPD_SERVER="nginx"
###
### Create directories
###
# /docker-entrypoint.d/10-ipv6* was added by nginx to do some IPv6 magic (which breaks the image)
RUN set -eux \
&& rm -rf /docker-entrypoint.d || true \
&& mkdir -p /etc/httpd-custom.d \
&& mkdir -p /etc/httpd/conf.d \
&& mkdir -p /etc/httpd/vhost.d \
&& mkdir -p /var/www/default/htdocs \
&& mkdir -p /var/log/httpd \
&& mkdir -p /shared/httpd \
&& chmod 0775 /shared/httpd \
&& chown ${MY_USER}:${MY_GROUP} /shared/httpd
###
### Symlink Python3 to Python
###
RUN set -eux \
&& ln -sf /usr/bin/python3 /usr/bin/python
###
### Set timezone
###
RUN set -eux \
&& if [ -f /etc/localtime ]; then rm /etc/localtime; fi \
&& ln -s /usr/share/zoneinfo/UTC /etc/localtime
###
### Copy files
###
COPY ./data/nginx/nginx.conf /etc/nginx/nginx.conf
COPY ./data/vhost-gen/templates-main /etc/vhost-gen/templates-main
COPY ./data/create-vhost.sh /usr/local/bin/create-vhost.sh
COPY ./data/docker-entrypoint.d /docker-entrypoint.d
COPY ./data/docker-entrypoint.sh /docker-entrypoint.sh
###
### Ports
###
EXPOSE 80
EXPOSE 443
###
### Volumes
###
VOLUME /shared/httpd
VOLUME /ca
###
### Signals
###
STOPSIGNAL SIGTERM
###
### Entrypoint
###
ENTRYPOINT ["/docker-entrypoint.sh"]