2022-03-14 23:25:47 +08:00
|
|
|
# Caddy is a requirement
|
2023-02-16 20:59:08 +08:00
|
|
|
FROM caddy:2.6.4-alpine as caddy
|
2022-03-14 23:25:47 +08:00
|
|
|
|
2023-03-08 21:00:51 +08:00
|
|
|
FROM httpd:2.4.56-alpine3.17
|
2023-01-28 02:43:55 +08:00
|
|
|
|
|
|
|
RUN set -ex; \
|
|
|
|
apk add --no-cache shadow; \
|
|
|
|
groupmod -g 333 xfs; \
|
|
|
|
usermod -u 333 -g 333 xfs; \
|
|
|
|
groupmod -g 33 www-data; \
|
|
|
|
usermod -u 33 -g 33 www-data; \
|
|
|
|
apk del --no-cache shadow
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
RUN mkdir -p /mnt/data; \
|
|
|
|
chown www-data:www-data /mnt/data;
|
|
|
|
|
|
|
|
VOLUME /mnt/data
|
|
|
|
|
|
|
|
RUN set -ex; \
|
2023-01-28 02:43:55 +08:00
|
|
|
apk add --no-cache \
|
|
|
|
bash \
|
2021-11-30 18:20:42 +08:00
|
|
|
supervisor \
|
|
|
|
wget \
|
2023-01-28 02:43:55 +08:00
|
|
|
tzdata \
|
2021-11-30 18:20:42 +08:00
|
|
|
ca-certificates \
|
|
|
|
openssl \
|
2023-01-28 02:43:55 +08:00
|
|
|
netcat-openbsd
|
2021-11-30 18:20:42 +08:00
|
|
|
|
2022-03-14 23:25:47 +08:00
|
|
|
COPY --from=caddy /usr/bin/caddy /usr/bin/
|
|
|
|
RUN chmod +x /usr/bin/caddy
|
2021-11-30 18:20:42 +08:00
|
|
|
|
2023-01-28 02:43:55 +08:00
|
|
|
RUN sed -i \
|
|
|
|
-e '/^Listen /d' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_rewrite.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_headers.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_proxy.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_proxy_fcgi.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_setenvif.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_env.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_mime.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_dir.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_authz_core.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_alias.so\)/\1/' \
|
|
|
|
-e 's/^#\(LoadModule .*mod_mpm_event.so\)/\1/' \
|
|
|
|
-e 's/\(LoadModule .*mod_mpm_worker.so\)/#\1/' \
|
|
|
|
-e 's/\(LoadModule .*mod_mpm_prefork.so\)/#\1/' \
|
|
|
|
conf/httpd.conf; \
|
|
|
|
echo "Include conf/nextcloud.conf" | tee -a conf/httpd.conf; \
|
|
|
|
echo "ServerName localhost" | tee -a conf/httpd.conf
|
|
|
|
|
|
|
|
COPY nextcloud.conf conf
|
2022-05-10 03:49:19 +08:00
|
|
|
|
2022-05-07 17:25:35 +08:00
|
|
|
RUN set -ex; \
|
2023-01-28 02:43:55 +08:00
|
|
|
rm -rf conf/original conf/original && \
|
2021-11-30 18:20:42 +08:00
|
|
|
rm -rf /var/www/html/* && \
|
2023-01-28 02:43:55 +08:00
|
|
|
mkdir /var/www && \
|
2021-11-30 18:20:42 +08:00
|
|
|
chown -R www-data:www-data /var/www;
|
|
|
|
|
|
|
|
RUN mkdir /var/log/supervisord; \
|
|
|
|
mkdir /var/run/supervisord; \
|
|
|
|
chown www-data:www-data /var/run/supervisord; \
|
|
|
|
chown www-data:www-data /var/log/supervisord;
|
|
|
|
|
|
|
|
COPY Caddyfile /
|
|
|
|
|
|
|
|
COPY start.sh /usr/bin/
|
2022-08-25 22:57:59 +08:00
|
|
|
COPY healthcheck.sh /usr/bin/
|
2021-11-30 18:20:42 +08:00
|
|
|
COPY supervisord.conf /
|
|
|
|
RUN chmod +x /usr/bin/start.sh; \
|
2022-08-25 22:57:59 +08:00
|
|
|
chmod +x /usr/bin/healthcheck.sh; \
|
2021-11-30 18:20:42 +08:00
|
|
|
chmod +r /supervisord.conf; \
|
2022-05-29 22:25:00 +08:00
|
|
|
chown www-data:www-data /Caddyfile; \
|
2023-01-28 02:43:55 +08:00
|
|
|
chown -R www-data:www-data /usr/local/apache2; \
|
|
|
|
chmod +r -R /usr/local/apache2
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
# Give root a random password
|
|
|
|
RUN echo "root:$(openssl rand -base64 12)" | chpasswd
|
|
|
|
|
|
|
|
USER www-data
|
|
|
|
|
|
|
|
ENTRYPOINT ["start.sh"]
|
2022-08-25 21:06:23 +08:00
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
|
|
|
|
2023-01-28 02:43:55 +08:00
|
|
|
HEALTHCHECK CMD healthcheck.sh
|
2023-01-30 22:33:12 +08:00
|
|
|
LABEL com.centurylinklabs.watchtower.monitor-only="true"
|