Public-Dockerfiles/skib_application_dockerfile

78 lines
3 KiB
Text
Raw Normal View History

2024-11-18 15:37:14 +01:00
ARG PHP_IMAGE_VERSION=3.20.5
FROM erseco/alpine-php-webserver:${PHP_IMAGE_VERSION}
2024-11-17 13:01:41 +01:00
2024-11-18 19:12:50 +01:00
ARG VERSION
ARG SUPERCRONIC_VERSION=0.2.33
2024-11-17 13:01:41 +01:00
LABEL version="${VERSION}" \
Maintainer="H2 invent GmbH" \
Description="Docker Image der Anwendung Unsere Schulkindbetreuung" \
org.opencontainers.version="${VERSION}" \
org.opencontainers.image.title="Unsere Schulkindbetreuung" \
org.opencontainers.image.license="INTERNAL" \
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/skb" \
org.opencontainers.image.documentation="https://unsere-schulkindbetreuung.de" \
org.opencontainers.image.url="https://unsere-schulkindbetreuung.de"
USER root
2024-11-18 19:12:50 +01:00
2024-11-17 13:01:41 +01:00
RUN apk --no-cache add \
unzip \
php83-xmlwriter \
php83-xsl \
php83-pcntl \
php83-posix \
php83-sockets \
&& rm -rf /var/cache/apk/*
RUN sed -i 's/^date.timezone=.*$/date.timezone="Europe\/Berlin"/' /etc/php83/conf.d/custom.ini
RUN echo "Europe/Berlin" > /etc/timezone
2024-11-18 19:12:50 +01:00
RUN wget https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-amd64 -O /supercronic \
2024-11-18 18:22:19 +01:00
&& chmod +x /supercronic
2024-11-17 13:01:41 +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
RUN mkdir /etc/service/cron \
&& echo "#!/bin/sh" > /etc/service/cron/run \
&& echo "exec 2>&1 /supercronic /var/crontab" >> /etc/service/cron/run \
&& chown -R nobody:nobody /etc/service/cron \
&& chmod -R +x /etc/service/cron
RUN echo "# Docker Cron Jobs" > /var/crontab \
2024-11-17 13:15:12 +01:00
&& echo "*/10 * * * * php /var/www/html/bin/console app:stats" >> /var/crontab \
2024-11-17 13:01:41 +01:00
&& echo "" >> /var/crontab \
&& chown nobody:nobody /var/crontab
2024-11-17 13:04:53 +01:00
RUN echo "#!/bin/sh" > /docker-entrypoint-init.d/02-symfony.sh \
2024-11-17 13:15:12 +01:00
&& echo "php bin/console cache:clear" >> /docker-entrypoint-init.d/02-symfony.sh \
&& echo "php bin/console doc:mig:mig --no-interaction" >> /docker-entrypoint-init.d/02-symfony.sh \
&& echo "php bin/console cache:clear" >> /docker-entrypoint-init.d/02-symfony.sh \
2024-11-18 18:42:21 +01:00
&& chmod +x /docker-entrypoint-init.d/02-symfony.sh
2024-11-17 13:01:41 +01:00
RUN --mount=type=secret,id=ARTIFACT_USER \
--mount=type=secret,id=ARTIFACT_SECRET \
--mount=type=secret,id=ARTIFACT_URL \
ARTIFACT_USER=$(cat /run/secrets/ARTIFACT_USER) \
ARTIFACT_SECRET=$(cat /run/secrets/ARTIFACT_SECRET) \
ARTIFACT_URL=$(cat /run/secrets/ARTIFACT_URL) \
2024-11-18 18:52:38 +01:00
&& wget https://${ARTIFACT_USER}:${ARTIFACT_SECRET}@${ARTIFACT_URL}-${VERSION}.zip -O artifact.zip \
2024-11-18 18:52:54 +01:00
&& unzip artifact.zip \
2024-11-18 18:52:38 +01:00
&& chown -R nobody public \
&& chown -R nobody var \
&& chmod -R 700 public \
&& chmod -R 700 var
2024-11-17 13:01:41 +01:00
2024-11-17 13:03:16 +01:00
RUN rm artifact.zip \
2024-11-17 13:04:07 +01:00
&& rm -r var/cache
2024-11-17 13:01:41 +01:00
USER nobody
ENV nginx_root_directory=/var/www/html/public \
memory_limit=1024M \
post_max_size=20M \
upload_max_filesize=10M \
PHP_DATE_TIMEZONE="Europe/Berlin"