summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'contrib')
-rw-r--r--contrib/Dockerfile46
-rw-r--r--contrib/docker-compose.yml50
-rw-r--r--contrib/nginx/Dockerfile2
-rw-r--r--contrib/nginx/nginx.conf42
4 files changed, 140 insertions, 0 deletions
diff --git a/contrib/Dockerfile b/contrib/Dockerfile
new file mode 100644
index 00000000..f5446e77
--- /dev/null
+++ b/contrib/Dockerfile
@@ -0,0 +1,46 @@
+FROM composer AS composer
+COPY composer.json /app/
+RUN composer --no-ansi install --no-dev --ignore-platform-reqs
+RUN composer --no-ansi dump-autoload --optimize
+
+FROM node:8-alpine as themes
+WORKDIR /app
+COPY frontend/ /app/frontend
+COPY .babelrc package.json webpack.config.js /app/
+RUN apk add --no-cache yarn
+RUN yarn install
+RUN yarn build
+
+# Intermediate container for less layers
+FROM alpine as data
+COPY bin/ /app/bin
+COPY config/ /app/config
+COPY db/ /app/db
+COPY includes/ /app/includes
+COPY locale/ /app/locale
+COPY public/ /app/public
+COPY src/ /app/src
+COPY templates/ /app/templates
+
+COPY composer.json LICENSE package.json README.md /app/
+
+COPY --from=composer /app/vendor/ /app/vendor
+COPY --from=composer /app/composer.lock /app/
+
+COPY --from=themes /app/public/assets /app/public/assets
+COPY --from=themes /app/yarn.lock /app/
+
+RUN rm -f /app/config/config.php
+
+FROM php:7-fpm-alpine
+WORKDIR /var/www
+COPY --from=data /app/ /var/www
+RUN apk add --no-cache icu-dev gettext-dev && \
+ docker-php-ext-install intl gettext pdo_mysql && \
+ rm -r /var/www/html
+
+ENV TRUSTED_PROXIES 10.0.0.0/8,::ffff:10.0.0.0/8,\
+ 127.0.0.0/8,::ffff:127.0.0.0/8,\
+ 172.16.0.0/12,::ffff:172.16.0.0/12,\
+ 192.168.0.0/16,::ffff:192.168.0.0/16,\
+ ::1/128,fc00::/7,fec0::/10
diff --git a/contrib/docker-compose.yml b/contrib/docker-compose.yml
new file mode 100644
index 00000000..1dbb7e81
--- /dev/null
+++ b/contrib/docker-compose.yml
@@ -0,0 +1,50 @@
+version: "3.6"
+services:
+ nginx:
+ image: engelsystem-nginx
+ build:
+ context: ..
+ dockerfile: contrib/nginx/Dockerfile
+ ports:
+ - 5000:80
+ volumes:
+ - static:/var/www/html
+ networks:
+ - internal
+ depends_on:
+ - engelsystem
+ engelsystem:
+ image: engelsystem
+ build:
+ context: ..
+ dockerfile: contrib/Dockerfile
+ environment:
+ MYSQL_HOST: database
+ MYSQL_USER: engelsystem
+ MYSQL_PASSWORD: engelsystem
+ MYSQL_DATABASE: engelsystem
+ volumes:
+ - static:/var/www/html
+ networks:
+ - internal
+ - database
+ depends_on:
+ - database
+ database:
+ image: mariadb:latest
+ environment:
+ MYSQL_DATABASE: engelsystem
+ MYSQL_USER: engelsystem
+ MYSQL_PASSWORD: engelsystem
+ MYSQL_RANDOM_ROOT_PASSWORD: 1
+ volumes:
+ - db:/var/lib/mysql
+ networks:
+ - database
+volumes:
+ db: {}
+ static: {}
+
+networks:
+ internal:
+ database:
diff --git a/contrib/nginx/Dockerfile b/contrib/nginx/Dockerfile
new file mode 100644
index 00000000..a06ea3e7
--- /dev/null
+++ b/contrib/nginx/Dockerfile
@@ -0,0 +1,2 @@
+FROM nginx:alpine
+COPY contrib/nginx/nginx.conf /etc/nginx/nginx.conf
diff --git a/contrib/nginx/nginx.conf b/contrib/nginx/nginx.conf
new file mode 100644
index 00000000..d95c18e2
--- /dev/null
+++ b/contrib/nginx/nginx.conf
@@ -0,0 +1,42 @@
+error_log stderr;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ client_body_temp_path /tmp/client_body_temp;
+ fastcgi_temp_path /tmp/fastcgi_temp;
+ proxy_temp_path /tmp/proxy_temp;
+ scgi_temp_path /tmp/scgi_temp;
+ uwsgi_temp_path /tmp/uwsgi_temp;
+
+ map $http_x_forwarded_proto $forwarded_proto {
+ default $http_x_forwarded_proto;
+ https https;
+ }
+
+ server {
+ include mime.types;
+ access_log off;
+ listen [::]:80 ipv6only=off;
+ proxy_redirect off;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $forwarded_proto;
+ index index.php;
+ root /var/www/public;
+
+ location / {
+ try_files $uri $uri/ /index.php?$args;
+ }
+
+ location ~ \.php$ {
+ fastcgi_pass engelsystem:9000;
+ fastcgi_index index.php;
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+ include fastcgi_params;
+ }
+ }
+}