Skip to content

Commit

Permalink
Merge pull request #297 from H2-invent/feature/dockerfile
Browse files Browse the repository at this point in the history
Feature/dockerfile
  • Loading branch information
holzi1005 authored Jan 14, 2025
2 parents 55119db + ec7b0b3 commit 65e57a2
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 4,645 deletions.
90 changes: 58 additions & 32 deletions Dockerfile
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
4 changes: 3 additions & 1 deletion RELEASE_NOTE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* In den TOM Formularen können jetzt die technischen und organisatorischen Maßnahmen mit einem WYSIWYG Editor beschrieben werden. (https://github.com/H2-invent/open-datenschutzcenter/pull/217)
* Der neue Assistent unterstützt beim Erstellen von Verarbeitungen und allen notwendigen Datensätzen. Dieser Assistent erleichtert die Erfassung von neuen Verarbeitungen. (https://github.com/H2-invent/open-datenschutzcenter/pull/204)
* Ab sofort können Datenschutzelemente von einem Team in Kinderteams vererbt werden. (https://github.com/H2-invent/open-datenschutzcenter/pull/205)

* Add new Dockerfile for the ODC

## Bug fixes


## Update Anleitung
* Die Anleitung zum Installieren des ODCs mit hilfe Docker Compose wurde angepasst (https://github.com/H2-invent/open-datenschutzcenter/wiki/Get-Started)
42 changes: 0 additions & 42 deletions docker-compose.dev.yml

This file was deleted.

162 changes: 0 additions & 162 deletions docker-compose.test.yml

This file was deleted.

Loading

0 comments on commit 65e57a2

Please sign in to comment.