mirror of
https://github.com/nextcloud/all-in-one.git
synced 2024-12-29 10:10:55 +08:00
migrate mastercontainer to alpine (#1577)
This commit is contained in:
parent
123c1be6b7
commit
4e74052c20
4 changed files with 86 additions and 42 deletions
|
@ -4,8 +4,15 @@ FROM docker:20.10.23-dind as dind
|
|||
# Caddy is a requirement
|
||||
FROM caddy:2.6.2-alpine as caddy
|
||||
|
||||
# From https://github.com/docker-library/php/blob/master/8.0/bullseye/apache/Dockerfile
|
||||
FROM php:8.1.14-apache-bullseye
|
||||
# From https://github.com/docker-library/php/blob/master/8.1/alpine3.17/fpm/Dockerfile
|
||||
FROM php:8.1.14-fpm-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
|
||||
|
||||
EXPOSE 80
|
||||
EXPOSE 8080
|
||||
|
@ -19,16 +26,38 @@ RUN mkdir -p /var/www/docker-aio;
|
|||
|
||||
WORKDIR /var/www/docker-aio
|
||||
|
||||
RUN apt-get update; \
|
||||
apt-get install -y --no-install-recommends \
|
||||
git \
|
||||
RUN set -ex; \
|
||||
apk add --no-cache \
|
||||
ca-certificates \
|
||||
wget \
|
||||
tzdata \
|
||||
bash \
|
||||
apache2 \
|
||||
apache2-proxy \
|
||||
apache2-ssl \
|
||||
supervisor \
|
||||
openssl \
|
||||
sudo \
|
||||
dpkg-dev \
|
||||
netcat \
|
||||
; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
netcat-openbsd \
|
||||
grep
|
||||
|
||||
RUN set -ex; \
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
autoconf \
|
||||
build-base; \
|
||||
pecl install APCu-5.1.22; \
|
||||
docker-php-ext-enable apcu; \
|
||||
rm -r /tmp/pear; \
|
||||
\
|
||||
runDeps="$( \
|
||||
scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \
|
||||
| tr ',' '\n' \
|
||||
| sort -u \
|
||||
| awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \
|
||||
)"; \
|
||||
apk add --virtual .nextcloud-aio-rundeps $runDeps; \
|
||||
apk del .build-deps; \
|
||||
sed -i 's|access.log = /proc/self/fd/2|access.log = /proc/self/fd/1|' /usr/local/etc/php-fpm.d/docker.conf
|
||||
|
||||
COPY --from=caddy /usr/bin/caddy /usr/bin/
|
||||
RUN chmod +x /usr/bin/caddy
|
||||
|
@ -36,14 +65,10 @@ RUN chmod +x /usr/bin/caddy
|
|||
COPY --from=dind /usr/local/bin/docker /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/docker
|
||||
|
||||
RUN set -ex; \
|
||||
pecl install APCu-5.1.22; \
|
||||
docker-php-ext-enable apcu
|
||||
|
||||
RUN set -e && \
|
||||
curl -sS https://getcomposer.org/installer | php && \
|
||||
mv composer.phar /usr/local/bin/composer && \
|
||||
chmod +x /usr/local/bin/composer && \
|
||||
apk add --no-cache git; \
|
||||
wget https://getcomposer.org/installer -O - | php -- --install-dir=/usr/local/bin --filename=composer; \
|
||||
chmod +x /usr/local/bin/composer; \
|
||||
cd /var/www/docker-aio; \
|
||||
git clone https://github.com/nextcloud-releases/all-in-one.git --depth 1 .; \
|
||||
cd php; \
|
||||
|
@ -54,7 +79,8 @@ RUN set -e && \
|
|||
chmod 770 -R ./; \
|
||||
chown www-data:www-data -R /var/www; \
|
||||
rm -r ./php/data; \
|
||||
rm -r ./php/session
|
||||
rm -r ./php/session; \
|
||||
apk del --no-cache git
|
||||
|
||||
RUN mkdir -p /etc/apache2/certs && \
|
||||
cd /etc/apache2/certs && \
|
||||
|
@ -62,28 +88,31 @@ RUN mkdir -p /etc/apache2/certs && \
|
|||
|
||||
COPY mastercontainer.conf /etc/apache2/sites-available/
|
||||
|
||||
RUN a2enmod rewrite \
|
||||
headers \
|
||||
env \
|
||||
mime \
|
||||
dir \
|
||||
authz_core \
|
||||
proxy \
|
||||
proxy_http \
|
||||
ssl
|
||||
|
||||
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
|
||||
RUN sed -i \
|
||||
-e '/^Listen /d' \
|
||||
-e 's/User apache/User www-data/g' \
|
||||
-e 's/Group apache/Group www-data/g' \
|
||||
-e 's/^#\(LoadModule .*mod_rewrite.so\)/\1/' \
|
||||
-e 's/^#\(LoadModule .*mod_headers.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_mpm_event.so\)/\1/' \
|
||||
-e 's/\(LoadModule .*mod_mpm_worker.so\)/#\1/' \
|
||||
-e 's/\(LoadModule .*mod_mpm_prefork.so\)/#\1/' \
|
||||
/etc/apache2/httpd.conf; \
|
||||
mkdir -p /etc/apache2/logs; \
|
||||
rm /etc/apache2/conf.d/ssl.conf; \
|
||||
echo "ServerName localhost" | tee -a /etc/apache2/httpd.conf; \
|
||||
echo "LoadModule ssl_module modules/mod_ssl.so" | tee -a /etc/apache2/httpd.conf; \
|
||||
echo "LoadModule socache_shmcb_module modules/mod_socache_shmcb.so" | tee -a /etc/apache2/httpd.conf; \
|
||||
echo "Include /etc/apache2/sites-available/mastercontainer.conf" | tee -a /etc/apache2/httpd.conf
|
||||
|
||||
RUN set -ex; \
|
||||
a2dissite 000-default && \
|
||||
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 mastercontainer.conf
|
||||
rm -f /etc/apache2/conf.d/default.conf \
|
||||
/etc/apache2/conf.d/userdir.conf \
|
||||
/etc/apache2/conf.d/info.conf
|
||||
|
||||
RUN mkdir /var/log/supervisord; \
|
||||
mkdir /var/run/supervisord;
|
||||
|
@ -109,4 +138,4 @@ USER root
|
|||
ENTRYPOINT ["start.sh"]
|
||||
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
||||
|
||||
HEALTHCHECK CMD /healthcheck.sh
|
||||
HEALTHCHECK CMD /healthcheck.sh
|
||||
|
|
|
@ -10,9 +10,13 @@ Listen 8080
|
|||
<VirtualHost *:8000>
|
||||
ServerName localhost
|
||||
|
||||
# Add error log
|
||||
CustomLog /proc/self/fd/1 combined
|
||||
ErrorLog /proc/self/fd/2
|
||||
|
||||
# PHP match
|
||||
<FilesMatch "\.php$">
|
||||
SetHandler application/x-httpd-php
|
||||
SetHandler "proxy:fcgi://localhost:9000"
|
||||
</FilesMatch>
|
||||
# Master dir
|
||||
DocumentRoot /var/www/docker-aio/php/public/
|
||||
|
|
|
@ -239,8 +239,8 @@ chown root:root -R /mnt/docker-aio-config/certs/
|
|||
|
||||
# Don't allow access to the AIO interface from the Nextcloud container
|
||||
# Probably more cosmetic than anything but at least an attempt
|
||||
if ! grep -q '# nextcloud-aio-block' /etc/apache2/apache2.conf; then
|
||||
cat << APACHE_CONF >> /etc/apache2/apache2.conf
|
||||
if ! grep -q '# nextcloud-aio-block' /etc/apache2/httpd.conf; then
|
||||
cat << APACHE_CONF >> /etc/apache2/httpd.conf
|
||||
# nextcloud-aio-block-start
|
||||
<Location />
|
||||
order allow,deny
|
||||
|
@ -277,4 +277,7 @@ https://your-domain-that-points-to-this-server.tld:8443"
|
|||
# Set the timezone to UTC
|
||||
export TZ=UTC
|
||||
|
||||
# Fix apache startup
|
||||
rm -f /var/run/apache2/httpd.pid
|
||||
|
||||
exec "$@"
|
||||
|
|
|
@ -8,12 +8,20 @@ logfile_backups=10
|
|||
loglevel=error
|
||||
user=root
|
||||
|
||||
[program:php-fpm]
|
||||
# stdout_logfile=/dev/stdout
|
||||
# stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=php-fpm
|
||||
user=root
|
||||
|
||||
[program:apache]
|
||||
# stdout_logfile=/dev/stdout
|
||||
# stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
command=apache2-foreground
|
||||
command=httpd -DFOREGROUND
|
||||
user=root
|
||||
|
||||
[program:caddy]
|
||||
|
|
Loading…
Reference in a new issue