-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from H2-invent/feature/dockerfile
Feature/dockerfile
- Loading branch information
Showing
13 changed files
with
61 additions
and
4,645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,59 @@ | ||
FROM thecodingmachine/php:8.2-v4-apache-node16 | ||
ENV PHP_EXTENSION_LDAP=1 | ||
ENV PHP_EXTENSION_INTL=1 | ||
ENV TZ=Europe/Berlin | ||
ENV COMPOSER_ALLOW_SUPERUSER=1 | ||
USER root | ||
RUN usermod -a -G www-data docker | ||
#Do npm install | ||
COPY package.json /var/www/html | ||
COPY package-lock.json /var/www/html | ||
COPY webpack.config.js /var/www/html | ||
RUN npm install | ||
#do npm build | ||
COPY assets /var/www/html/assets | ||
COPY public /var/www/html/public | ||
RUN mkdir -m 777 -p public/build | ||
RUN npm run build | ||
RUN rm -rf node_modules/ | ||
#copy all the rest of the app | ||
COPY . /var/www/html | ||
#install all php dependencies | ||
|
||
RUN chown -R docker:docker secretStorage | ||
USER docker | ||
RUN composer install | ||
ARG PHP_IMAGE_VERSION=3.20.6 | ||
FROM git.h2-invent.com/public-system-design/alpine-php8-webserver:${PHP_IMAGE_VERSION} | ||
|
||
ARG VERSION | ||
ARG SUPERCRONIC_VERSION=0.2.33 | ||
|
||
LABEL version="${VERSION}" \ | ||
Maintainer="H2 invent GmbH" \ | ||
Description="Docker Image for 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 <[email protected]>" \ | ||
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 | ||
#do all the directory stuff | ||
RUN chmod -R 775 public/build | ||
RUN mkdir -p var/cache | ||
RUN chown -R docker:docker var | ||
RUN chmod -R 777 var | ||
RUN chown -R docker:docker var/ | ||
USER docker | ||
|
||
RUN apk --no-cache add \ | ||
unzip \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
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 wget https://github.com/aptible/supercronic/releases/download/v${SUPERCRONIC_VERSION}/supercronic-linux-amd64 -O /supercronic \ | ||
&& chmod +x /supercronic | ||
|
||
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 echo "# Docker Cron Jobs" > /var/crontab \ | ||
&& echo "SHELL=/bin/sh" >> /var/crontab \ | ||
&& echo "* * * * * date" >> /var/crontab \ | ||
&& echo "0 1 * * * curl https://open-datenschutzcenter.de/health/check" >> /var/crontab \ | ||
&& echo "0 9 * * 1-5 /bin/sh /distributed_cron.sh 'data/cron_log' 'php /var/www/html/bin/console app:cron'" >> /var/crontab \ | ||
&& echo "" >> /var/crontab | ||
|
||
RUN echo "#!/bin/sh" > /docker-entrypoint-init.d/01-symfony.sh \ | ||
&& echo "php bin/console cache:clear" >> /docker-entrypoint-init.d/01-symfony.sh \ | ||
&& echo "php bin/console doc:mig:mig --no-interaction" >> /docker-entrypoint-init.d/01-symfony.sh \ | ||
&& echo "php bin/console cache:clear" >> /docker-entrypoint-init.d/01-symfony.sh \ | ||
&& chmod +x /docker-entrypoint-init.d/01-symfony.sh | ||
|
||
USER nobody | ||
|
||
RUN wget https://github.com/H2-invent/open-datenschutzcenter/releases/download/${VERSION}/application.zip -O artifact.zip \ | ||
&& unzip artifact.zip \ | ||
&& mkdir data \ | ||
&& rm -r var/cache \ | ||
&& rm artifact.zip | ||
|
||
ENV nginx_root_directory=/var/www/html/public \ | ||
upload_max_filesize=10M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.