-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDockerfile.alpine
241 lines (205 loc) · 6.82 KB
/
Dockerfile.alpine
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# vi: ft=dockerfile
FROM alpine:3.5 as builder
RUN set -eux \
&& apk add -U shadow
FROM httpd:2.2-alpine
MAINTAINER "cytopia" <[email protected]>
LABEL \
name="cytopia's apache 2.2 image" \
image="devilbox/apache-2.2" \
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
ARG ARCH=linux/amd64
ENV BUILD_DEPS \
autoconf \
gcc \
musl-dev \
make \
wget
ENV RUN_DEPS \
ca-certificates \
bash \
findutils \
openssl \
py-yaml \
supervisor \
tzdata
###
### Install required packages
###
RUN set -eux \
&& apk add -U \
${BUILD_DEPS} \
${RUN_DEPS} \
\
# Required symlinks to build mod-proxy-fcgi on i386
&& if [ "${ARCH}" = "linux/386" ]; then \
ln -s $(which ar) /usr/bin/i586-linux-gnu-ar; \
ln -s $(which ranlib) /usr/bin/i586-linux-gnu-ranlib ; \
fi \
\
# mod-proxy-fcgi
&& wget --no-check-certificate -O mod-proxy-fcgi.tar.gz https://github.com/devilbox/mod-proxy-fcgi/archive/master.tar.gz \
&& tar xvfz mod-proxy-fcgi.tar.gz \
&& cd mod-proxy-fcgi-master \
&& autoconf \
&& ./configure \
&& make \
&& make install \
&& cd .. \
&& rm -rf mod-proxy-fcgi* \
\
# 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
&& apk del \
${BUILD_DEPS}
###
### Configure Apache
###
RUN set -eux \
&& ( \
echo "ServerName localhost"; \
echo "LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so"; \
echo "NameVirtualHost *:80"; \
echo "Include conf/extra/httpd-default.conf"; \
echo "Include /etc/httpd-custom.d/*.conf"; \
echo "Include /etc/httpd/conf.d/*.conf"; \
echo "Include /etc/httpd/vhost.d/*.conf"; \
\
#echo "LoadModule ssl_module modules/mod_ssl.so"; \
echo "Listen 443"; \
echo "NameVirtualHost *:443"; \
echo "SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES"; \
echo "SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES"; \
echo "SSLHonorCipherOrder on"; \
echo "SSLProtocol all -SSLv2 -SSLv3"; \
echo "SSLProxyProtocol all -SSLv2 -SSLv3"; \
echo "SSLPassPhraseDialog builtin"; \
echo "SSLSessionCache \"shmcb:/usr/local/apache2/logs/ssl_scache(512000)\""; \
echo "SSLSessionCacheTimeout 300"; \
echo "SSLMutex \"file:/usr/local/apache2/logs/ssl_mutex\""; \
\
echo "HTTPProtocolOptions unsafe"; \
) >> /usr/local/apache2/conf/httpd.conf
###
### Runtime arguments
###
ENV MY_USER=daemon
ENV MY_GROUP=daemon
ENV HTTPD_START="httpd-foreground"
ENV HTTPD_RELOAD="/usr/local/apache2/bin/httpd -k restart"
ENV HTTPD_VERSION="httpd -V 2>&1 | head -1 | awk '{print \$3}'"
ENV VHOSTGEN_HTTPD_SERVER="apache22"
###
### Create directories
###
RUN set -eux \
&& 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/python2 /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/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
###
### Backporting from Alpine 3.5
###
# Required for usermod and groupmod
COPY --from=builder /etc/pam.d /etc/pam.d
COPY --from=builder /etc/security /etc/security
COPY --from=builder /etc/login.defs /etc/login.defs
COPY --from=builder /lib/security /lib/security
COPY --from=builder /lib/libpam.so.0 /lib/libpam.so.0
COPY --from=builder /lib/libpam.so.0.84.1 /lib/libpam.so.0.84.1
COPY --from=builder /lib/libpam_misc.so.0 /lib/libpam_misc.so.0
COPY --from=builder /lib/libpam_misc.so.0.82.1 /lib/libpam_misc.so.0.82.1
COPY --from=builder /lib/libpamc.so.0 /lib/libpamc.so.0
COPY --from=builder /lib/libpamc.so.0.82.1 /lib/libpamc.so.0.82.1
#COPY --from=builder /usr/bin/faillog /usr/bin/faillog
#COPY --from=builder /usr/bin/gpasswd /usr/bin/gpasswd
#COPY --from=builder /usr/bin/sg /usr/bin/sg
#COPY --from=builder /usr/bin/chfn /usr/bin/chfn
#COPY --from=builder /usr/bin/newgrp /usr/bin/newgrp
#COPY --from=builder /usr/bin/chsh /usr/bin/chsh
#COPY --from=builder /usr/bin/lastlog /usr/bin/lastlog
#COPY --from=builder /usr/bin/chage /usr/bin/chage
#COPY --from=builder /usr/bin/expiry /usr/bin/expiry
#COPY --from=builder /usr/sbin/newusers /usr/sbin/newusers
#COPY --from=builder /usr/sbin/pwconv /usr/sbin/pwconv
#COPY --from=builder /usr/sbin/groupmems /usr/sbin/groupmems
#COPY --from=builder /usr/sbin/vipw /usr/sbin/vipw
COPY --from=builder /usr/sbin/usermod /usr/sbin/usermod
#COPY --from=builder /usr/sbin/grpconv /usr/sbin/grpconv
#COPY --from=builder /usr/sbin/useradd /usr/sbin/useradd
COPY --from=builder /usr/sbin/groupmod /usr/sbin/groupmod
#COPY --from=builder /usr/sbin/grpck /usr/sbin/grpck
#COPY --from=builder /usr/sbin/userdel /usr/sbin/userdel
#COPY --from=builder /usr/sbin/groupdel /usr/sbin/groupdel
#COPY --from=builder /usr/sbin/pwck /usr/sbin/pwck
#COPY --from=builder /usr/sbin/pwunconv /usr/sbin/pwunconv
#COPY --from=builder /usr/sbin/chgpasswd /usr/sbin/chgpasswd
#COPY --from=builder /usr/sbin/logoutd /usr/sbin/logoutd
#COPY --from=builder /usr/sbin/grpunconv /usr/sbin/grpunconv
#COPY --from=builder /usr/sbin/vigr /usr/sbin/vigr
#COPY --from=builder /usr/sbin/groupadd /usr/sbin/groupadd
#COPY --from=builder /bin/groups /bin/groups
###
### Ports
###
EXPOSE 80
EXPOSE 443
###
### Volumes
###
VOLUME /shared/httpd
VOLUME /ca
###
### Signals
###
STOPSIGNAL SIGTERM
###
### Entrypoint
###
ENTRYPOINT ["/docker-entrypoint.sh"]