2022-03-14 23:25:47 +08:00
|
|
|
# Caddy is a requirement
|
2022-07-13 20:41:19 +08:00
|
|
|
FROM caddy:2.5.2-alpine as caddy
|
2022-03-14 23:25:47 +08:00
|
|
|
|
2022-08-23 20:40:04 +08:00
|
|
|
FROM debian:bullseye-20220822-slim
|
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; \
|
|
|
|
\
|
|
|
|
apt-get update; \
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
apache2 \
|
|
|
|
supervisor \
|
|
|
|
wget \
|
|
|
|
ca-certificates \
|
|
|
|
openssl \
|
|
|
|
netcat \
|
2022-01-19 21:22:33 +08:00
|
|
|
dpkg-dev \
|
2021-11-30 18:20:42 +08:00
|
|
|
; \
|
|
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
|
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
|
|
|
|
|
|
|
RUN a2enmod rewrite \
|
|
|
|
headers \
|
|
|
|
proxy \
|
|
|
|
proxy_fcgi \
|
|
|
|
setenvif \
|
|
|
|
env \
|
|
|
|
mime \
|
|
|
|
dir \
|
|
|
|
authz_core \
|
|
|
|
alias
|
|
|
|
|
|
|
|
COPY nextcloud.conf /etc/apache2/sites-available/
|
|
|
|
|
2022-05-10 03:49:19 +08:00
|
|
|
RUN rm /etc/apache2/ports.conf; \
|
|
|
|
sed -s -i -e "s/Include ports.conf//" /etc/apache2/apache2.conf; \
|
|
|
|
sed -i "/^Listen /d" /etc/apache2/apache2.conf
|
|
|
|
|
2022-05-07 17:25:35 +08:00
|
|
|
RUN set -ex; \
|
|
|
|
a2dissite 000-default && \
|
2021-11-30 18:20:42 +08:00
|
|
|
a2dissite default-ssl && \
|
|
|
|
a2ensite nextcloud.conf && \
|
|
|
|
rm -rf /var/www/html/* && \
|
|
|
|
chown www-data:www-data -R /var/log/apache2; \
|
2022-05-09 22:31:28 +08:00
|
|
|
mkdir -p /var/run/apache2; \
|
2021-11-30 18:20:42 +08:00
|
|
|
chown -R www-data:www-data /var/run/apache2; \
|
|
|
|
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/
|
|
|
|
COPY supervisord.conf /
|
|
|
|
RUN chmod +x /usr/bin/start.sh; \
|
|
|
|
chmod +r /supervisord.conf; \
|
2022-05-29 22:25:00 +08:00
|
|
|
chown www-data:www-data /Caddyfile; \
|
2022-05-07 17:25:35 +08:00
|
|
|
chmod +r -R /etc/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"]
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|