2024-11-15 08:28:32 +01:00
|
|
|
FROM erseco/alpine-php-webserver:3.20.5
|
|
|
|
|
|
|
|
ARG VERSION=
|
|
|
|
ARG WEBDIR=/var/www/html
|
|
|
|
|
|
|
|
LABEL version="${VERSION}" \
|
|
|
|
Maintainer="H2 invent GmbH" \
|
|
|
|
Description="Docker Image der Anwendung Open Datenschutzcenter" \
|
|
|
|
org.opencontainers.version="${VERSION}" \
|
|
|
|
org.opencontainers.image.title="Open Datenschutzcenter" \
|
|
|
|
org.opencontainers.image.license="AGPLv3" \
|
|
|
|
org.opencontainers.image.vendor="H2 invent GmbH" \
|
|
|
|
org.opencontainers.image.authors="Andreas Holzmann <support@h2-invent.com>" \
|
|
|
|
org.opencontainers.image.source="https://github.com/h2-invent/open-datenschutzcenter" \
|
|
|
|
org.opencontainers.image.documentation="https://open-datenschutzcenter.de" \
|
|
|
|
org.opencontainers.image.url="https://open-datenschutzcenter.de"
|
|
|
|
|
|
|
|
USER root
|
|
|
|
RUN apk --no-cache add \
|
|
|
|
unzip \
|
|
|
|
sqlite \
|
|
|
|
cronie \
|
|
|
|
libcap \
|
|
|
|
php83-sqlite3 \
|
|
|
|
php83-pdo_sqlite
|
|
|
|
|
2024-11-16 23:32:14 +01:00
|
|
|
#RUN mkdir /etc/service/crond \
|
|
|
|
# && echo "#!/bin/sh" > /etc/service/crond/run \
|
|
|
|
# && echo "exec 2>&1" >> /etc/service/crond/run \
|
|
|
|
# && echo "exec crond -f" >> /etc/service/crond/run \
|
|
|
|
# && chown -R nobody:nobody /etc/service/crond \
|
|
|
|
# && chmod -R +x /etc/service/crond
|
2024-11-16 23:15:39 +01:00
|
|
|
|
2024-11-16 22:36:44 +01:00
|
|
|
RUN chown nobody:nobody /usr/sbin/crond \
|
2024-11-15 08:28:32 +01:00
|
|
|
&& setcap cap_setgid=ep /usr/sbin/crond \
|
|
|
|
&& setcap cap_setuid=ep /usr/sbin/crond
|
|
|
|
|
2024-11-15 19:30:43 +01:00
|
|
|
RUN wget https://git.h2-invent.com/Public-System-Design/Public-Helperscripts/raw/branch/main/distributed_cron.sh -O /distributed_cron.sh \
|
|
|
|
&& chmod +x /distributed_cron.sh
|
|
|
|
|
2024-11-15 08:28:32 +01:00
|
|
|
RUN echo "# Docker Cron Jobs" > /etc/crontabs/nobody \
|
2024-11-16 23:46:55 +01:00
|
|
|
&& echo "SHELL=/bin/sh" >> /etc/crontabs/nobody \
|
2024-11-15 08:28:32 +01:00
|
|
|
&& echo "* * * * * curl http://localhost:8080/health/check > /dev/null > 2>&1" >> /etc/crontabs/nobody \
|
|
|
|
&& echo "0 1 * * * curl https://open-datenschutzcenter.de/health/check > /dev/null > 2>&1" >> /etc/crontabs/nobody \
|
2024-11-15 19:30:43 +01:00
|
|
|
&& echo "0 9 * * 1-5 /bin/sh /distributed_cron.sh '${WEBDIR}/data/cron_log' 'php ${WEBDIR}/bin/console app:cron' >/dev/null 2>&1" >> /etc/crontabs/nobody \
|
2024-11-16 22:39:00 +01:00
|
|
|
&& echo "" >> /etc/crontabs/nobody
|
|
|
|
|
|
|
|
RUN echo "#!/bin/sh" > /docker-entrypoint-init.d/01-symfony.sh \
|
|
|
|
&& echo "php ${WEBDIR}/bin/console cache:clear" >> /docker-entrypoint-init.d/01-symfony.sh \
|
|
|
|
&& echo "php ${WEBDIR}/bin/console doc:mig:mig --no-interaction" >> /docker-entrypoint-init.d/01-symfony.sh \
|
|
|
|
&& echo "php ${WEBDIR}/bin/console cache:clear" >> /docker-entrypoint-init.d/01-symfony.sh \
|
|
|
|
&& chmod +x /docker-entrypoint-init.d/01-symfony.sh
|
|
|
|
|
2024-11-16 23:32:14 +01:00
|
|
|
RUN echo "#!/bin/sh" > /docker-entrypoint-init.d/04-crond.sh \
|
2024-11-16 23:46:55 +01:00
|
|
|
&& echo "crond -c /etc/crontabs/nobody -f &" >> /docker-entrypoint-init.d/04-crond.sh \
|
2024-11-16 23:32:14 +01:00
|
|
|
&& chmod +x /docker-entrypoint-init.d/04-crond.sh
|
|
|
|
|
2024-11-15 08:28:32 +01:00
|
|
|
RUN wget https://github.com/H2-invent/open-datenschutzcenter/releases/download/${VERSION}/application.zip -O artifact.zip \
|
|
|
|
&& unzip artifact.zip -d ${WEBDIR} \
|
|
|
|
&& chown -R nobody ${WEBDIR}/public \
|
|
|
|
&& chown -R nobody ${WEBDIR}/var \
|
|
|
|
&& chmod -R 700 ${WEBDIR}/public \
|
|
|
|
&& chmod -R 700 ${WEBDIR}/var
|
|
|
|
|
|
|
|
RUN apk del unzip \
|
|
|
|
&& rm artifact.zip \
|
|
|
|
&& rm -r ${WEBDIR}/var/cache \
|
|
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
|
|
|
|
USER nobody
|
|
|
|
|
|
|
|
ENV nginx_root_directory=/var/www/html/public \
|
2024-11-15 08:28:15 +01:00
|
|
|
upload_max_filesize=10M
|