mirror of
https://github.com/nextcloud/all-in-one.git
synced 2024-09-21 07:16:09 +08:00
migrate apache container to alpine (#1573)
This commit is contained in:
parent
7a126a96d9
commit
123c1be6b7
|
@ -1,7 +1,15 @@
|
||||||
# Caddy is a requirement
|
# Caddy is a requirement
|
||||||
FROM caddy:2.6.2-alpine as caddy
|
FROM caddy:2.6.2-alpine as caddy
|
||||||
|
|
||||||
FROM debian:bullseye-20230109-slim
|
FROM httpd:2.4.54-alpine3.17
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
RUN mkdir -p /mnt/data; \
|
RUN mkdir -p /mnt/data; \
|
||||||
chown www-data:www-data /mnt/data;
|
chown www-data:www-data /mnt/data;
|
||||||
|
@ -9,51 +17,43 @@ RUN mkdir -p /mnt/data; \
|
||||||
VOLUME /mnt/data
|
VOLUME /mnt/data
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
\
|
apk add --no-cache \
|
||||||
apt-get update; \
|
bash \
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
apache2 \
|
|
||||||
supervisor \
|
supervisor \
|
||||||
wget \
|
wget \
|
||||||
|
tzdata \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
openssl \
|
openssl \
|
||||||
netcat \
|
netcat-openbsd
|
||||||
dpkg-dev \
|
|
||||||
; \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
COPY --from=caddy /usr/bin/caddy /usr/bin/
|
COPY --from=caddy /usr/bin/caddy /usr/bin/
|
||||||
RUN chmod +x /usr/bin/caddy
|
RUN chmod +x /usr/bin/caddy
|
||||||
|
|
||||||
RUN a2enmod rewrite \
|
RUN sed -i \
|
||||||
headers \
|
-e '/^Listen /d' \
|
||||||
proxy \
|
-e 's/^#\(LoadModule .*mod_rewrite.so\)/\1/' \
|
||||||
proxy_fcgi \
|
-e 's/^#\(LoadModule .*mod_headers.so\)/\1/' \
|
||||||
setenvif \
|
-e 's/^#\(LoadModule .*mod_proxy.so\)/\1/' \
|
||||||
env \
|
-e 's/^#\(LoadModule .*mod_proxy_fcgi.so\)/\1/' \
|
||||||
mime \
|
-e 's/^#\(LoadModule .*mod_setenvif.so\)/\1/' \
|
||||||
dir \
|
-e 's/^#\(LoadModule .*mod_env.so\)/\1/' \
|
||||||
authz_core \
|
-e 's/^#\(LoadModule .*mod_mime.so\)/\1/' \
|
||||||
alias
|
-e 's/^#\(LoadModule .*mod_dir.so\)/\1/' \
|
||||||
|
-e 's/^#\(LoadModule .*mod_authz_core.so\)/\1/' \
|
||||||
COPY nextcloud.conf /etc/apache2/sites-available/
|
-e 's/^#\(LoadModule .*mod_alias.so\)/\1/' \
|
||||||
|
-e 's/^#\(LoadModule .*mod_mpm_event.so\)/\1/' \
|
||||||
RUN rm /etc/apache2/ports.conf; \
|
-e 's/\(LoadModule .*mod_mpm_worker.so\)/#\1/' \
|
||||||
sed -s -i -e "s/Include ports.conf//" /etc/apache2/apache2.conf; \
|
-e 's/\(LoadModule .*mod_mpm_prefork.so\)/#\1/' \
|
||||||
sed -i "/^Listen /d" /etc/apache2/apache2.conf
|
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
|
||||||
|
|
||||||
RUN set -ex; \
|
RUN set -ex; \
|
||||||
a2dissite 000-default && \
|
rm -rf conf/original conf/original && \
|
||||||
a2dissite default-ssl && \
|
|
||||||
rm -f /etc/apache2/sites-enabled/000-default.conf && \
|
|
||||||
rm -f /etc/apache2/sites-enabled/default-ssl.conf && \
|
|
||||||
rm /etc/apache2/sites-available/000-default.conf && \
|
|
||||||
rm /etc/apache2/sites-available/default-ssl.conf && \
|
|
||||||
a2ensite nextcloud.conf && \
|
|
||||||
rm -rf /var/www/html/* && \
|
rm -rf /var/www/html/* && \
|
||||||
chown www-data:www-data -R /var/log/apache2; \
|
mkdir /var/www && \
|
||||||
mkdir -p /var/run/apache2; \
|
|
||||||
chown -R www-data:www-data /var/run/apache2; \
|
|
||||||
chown -R www-data:www-data /var/www;
|
chown -R www-data:www-data /var/www;
|
||||||
|
|
||||||
RUN mkdir /var/log/supervisord; \
|
RUN mkdir /var/log/supervisord; \
|
||||||
|
@ -70,7 +70,8 @@ RUN chmod +x /usr/bin/start.sh; \
|
||||||
chmod +x /usr/bin/healthcheck.sh; \
|
chmod +x /usr/bin/healthcheck.sh; \
|
||||||
chmod +r /supervisord.conf; \
|
chmod +r /supervisord.conf; \
|
||||||
chown www-data:www-data /Caddyfile; \
|
chown www-data:www-data /Caddyfile; \
|
||||||
chmod +r -R /etc/apache2
|
chown -R www-data:www-data /usr/local/apache2; \
|
||||||
|
chmod +r -R /usr/local/apache2
|
||||||
|
|
||||||
# Give root a random password
|
# Give root a random password
|
||||||
RUN echo "root:$(openssl rand -base64 12)" | chpasswd
|
RUN echo "root:$(openssl rand -base64 12)" | chpasswd
|
||||||
|
@ -80,4 +81,4 @@ USER www-data
|
||||||
ENTRYPOINT ["start.sh"]
|
ENTRYPOINT ["start.sh"]
|
||||||
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
||||||
|
|
||||||
HEALTHCHECK CMD healthcheck.sh
|
HEALTHCHECK CMD healthcheck.sh
|
||||||
|
|
|
@ -48,7 +48,7 @@ echo "$CADDYFILE" > /Caddyfile
|
||||||
# Add caddy path
|
# Add caddy path
|
||||||
mkdir -p /mnt/data/caddy/
|
mkdir -p /mnt/data/caddy/
|
||||||
|
|
||||||
# Fix apache sturtup
|
# Fix apache startup
|
||||||
rm -f /var/run/apache2/apache2.pid
|
rm -f /usr/local/apache2/logs/httpd.pid
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
Loading…
Reference in a new issue