2022-02-11 22:47:49 +08:00
|
|
|
# Docker CLI is a requirement
|
2023-04-27 21:17:33 +08:00
|
|
|
FROM docker:23.0.5-cli as docker
|
2022-02-11 22:47:49 +08:00
|
|
|
|
2022-03-14 23:25:47 +08:00
|
|
|
# Caddy is a requirement
|
2023-02-16 20:59:11 +08:00
|
|
|
FROM caddy:2.6.4-alpine as caddy
|
2022-03-14 23:25:47 +08:00
|
|
|
|
2023-01-28 04:36:53 +08:00
|
|
|
# From https://github.com/docker-library/php/blob/master/8.1/alpine3.17/fpm/Dockerfile
|
2023-04-17 21:01:52 +08:00
|
|
|
FROM php:8.1.18-fpm-alpine3.17
|
2023-01-28 04:36:53 +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
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
EXPOSE 80
|
2021-12-03 19:14:39 +08:00
|
|
|
EXPOSE 8080
|
2021-11-30 18:20:42 +08:00
|
|
|
EXPOSE 8443
|
|
|
|
|
2021-12-03 19:14:39 +08:00
|
|
|
RUN mkdir -p /var/www/docker-aio;
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
WORKDIR /var/www/docker-aio
|
|
|
|
|
2023-01-28 04:36:53 +08:00
|
|
|
RUN set -ex; \
|
|
|
|
apk add --no-cache \
|
2023-02-20 17:47:11 +08:00
|
|
|
util-linux-misc \
|
2023-01-28 04:36:53 +08:00
|
|
|
ca-certificates \
|
|
|
|
wget \
|
|
|
|
bash \
|
|
|
|
apache2 \
|
|
|
|
apache2-proxy \
|
|
|
|
apache2-ssl \
|
2021-11-30 18:20:42 +08:00
|
|
|
supervisor \
|
|
|
|
openssl \
|
|
|
|
sudo \
|
2023-01-28 04:36:53 +08:00
|
|
|
netcat-openbsd \
|
2023-01-28 04:52:37 +08:00
|
|
|
curl \
|
2023-01-28 04:36:53 +08:00
|
|
|
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; \
|
2023-02-10 20:42:03 +08:00
|
|
|
grep -q '^pm = dynamic' /usr/local/etc/php-fpm.d/www.conf; \
|
|
|
|
sed -i 's/^pm = dynamic/pm = ondemand/' /usr/local/etc/php-fpm.d/www.conf; \
|
|
|
|
sed -i 's/^pm.max_children =.*/pm.max_children = 80/' /usr/local/etc/php-fpm.d/www.conf; \
|
2023-01-28 04:36:53 +08:00
|
|
|
sed -i 's|access.log = /proc/self/fd/2|access.log = /proc/self/fd/1|' /usr/local/etc/php-fpm.d/docker.conf
|
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-03-31 00:05:02 +08:00
|
|
|
COPY --from=docker /usr/local/bin/docker /usr/local/bin/
|
2021-12-08 01:35:18 +08:00
|
|
|
RUN chmod +x /usr/local/bin/docker
|
|
|
|
|
2022-01-10 18:31:44 +08:00
|
|
|
RUN set -e && \
|
2023-01-28 04:36:53 +08:00
|
|
|
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; \
|
2022-01-10 18:31:44 +08:00
|
|
|
cd /var/www/docker-aio; \
|
2022-01-28 19:35:40 +08:00
|
|
|
git clone https://github.com/nextcloud-releases/all-in-one.git --depth 1 .; \
|
2023-04-28 00:57:35 +08:00
|
|
|
find ./ -not -path ./php -maxdepth 1 -mindepth 1 -delete; \
|
2023-05-02 05:31:20 +08:00
|
|
|
chown www-data:www-data -R /var/www/docker-aio; \
|
2022-01-10 18:31:44 +08:00
|
|
|
cd php; \
|
2023-05-02 05:31:20 +08:00
|
|
|
sudo -u www-data composer install --no-dev; \
|
|
|
|
sudo -u www-data composer clearcache; \
|
2022-01-10 18:31:44 +08:00
|
|
|
cd ..; \
|
|
|
|
rm -f /usr/local/bin/composer; \
|
2021-12-03 20:13:51 +08:00
|
|
|
chmod 770 -R ./; \
|
2022-10-30 08:02:46 +08:00
|
|
|
chown www-data:www-data -R /var/www; \
|
2021-12-03 22:32:47 +08:00
|
|
|
rm -r ./php/data; \
|
2023-01-28 04:36:53 +08:00
|
|
|
rm -r ./php/session; \
|
|
|
|
apk del --no-cache git
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
RUN mkdir -p /etc/apache2/certs && \
|
|
|
|
cd /etc/apache2/certs && \
|
2021-12-03 19:14:39 +08:00
|
|
|
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 -subj "/C=DE/ST=BE/L=Local/O=Dev/CN=nextcloud.local" -keyout ./ssl.key -out ./ssl.crt;
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
COPY mastercontainer.conf /etc/apache2/sites-available/
|
|
|
|
|
2023-01-28 04:36:53 +08:00
|
|
|
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
|
2021-11-30 18:20:42 +08:00
|
|
|
|
2022-10-31 18:49:37 +08:00
|
|
|
RUN set -ex; \
|
2023-01-28 04:36:53 +08:00
|
|
|
rm -f /etc/apache2/conf.d/default.conf \
|
|
|
|
/etc/apache2/conf.d/userdir.conf \
|
|
|
|
/etc/apache2/conf.d/info.conf
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
RUN mkdir /var/log/supervisord; \
|
2021-12-03 19:14:39 +08:00
|
|
|
mkdir /var/run/supervisord;
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
COPY Caddyfile /
|
|
|
|
COPY start.sh /usr/bin/
|
2022-04-05 01:12:07 +08:00
|
|
|
COPY backup-time-file-watcher.sh /
|
2022-04-06 21:11:24 +08:00
|
|
|
COPY session-deduplicator.sh /
|
2021-11-30 18:20:42 +08:00
|
|
|
COPY cron.sh /
|
2022-07-11 03:47:25 +08:00
|
|
|
COPY daily-backup.sh /
|
2021-11-30 18:20:42 +08:00
|
|
|
COPY supervisord.conf /
|
2022-09-05 19:23:40 +08:00
|
|
|
COPY healthcheck.sh /
|
2021-11-30 18:20:42 +08:00
|
|
|
RUN chmod +x /usr/bin/start.sh; \
|
2022-04-05 01:12:07 +08:00
|
|
|
chmod +x /cron.sh; \
|
2022-04-06 21:11:24 +08:00
|
|
|
chmod +x /session-deduplicator.sh; \
|
2022-04-20 23:00:51 +08:00
|
|
|
chmod +x /backup-time-file-watcher.sh; \
|
2022-07-11 03:47:25 +08:00
|
|
|
chmod +x /daily-backup.sh; \
|
2022-09-05 19:23:40 +08:00
|
|
|
chmod a+r /Caddyfile; \
|
|
|
|
chmod +x /healthcheck.sh
|
2021-11-30 18:20:42 +08:00
|
|
|
|
2021-12-03 19:14:39 +08:00
|
|
|
USER root
|
2021-11-30 18:20:42 +08:00
|
|
|
|
|
|
|
ENTRYPOINT ["start.sh"]
|
|
|
|
CMD ["/usr/bin/supervisord", "-c", "/supervisord.conf"]
|
2022-08-25 21:06:23 +08:00
|
|
|
|
2023-01-28 04:36:53 +08:00
|
|
|
HEALTHCHECK CMD /healthcheck.sh
|