From 68653be47b1e2dc06b56aaa346e4736e71a98ceb Mon Sep 17 00:00:00 2001 From: Nadav Goldenberg Date: Thu, 14 Nov 2019 16:07:24 +0200 Subject: [PATCH] Added docker-compose, dockerfile for custom fpm and nginx config --- docker-compose.yml | 48 +++++++++++++++++++++++++++++++++++++++++++ flarum-fpm.dockerfile | 4 ++++ nginx/flarum.conf | 21 +++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 docker-compose.yml create mode 100644 flarum-fpm.dockerfile create mode 100644 nginx/flarum.conf diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..818cbf6 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,48 @@ +version: "3" +services: + web: + image: nginx:alpine + volumes: + - ./:/var/www + - ./nginx/flarum.conf:/etc/nginx/conf.d/default.conf + - ./.nginx.conf:/etc/nginx/conf.d/.nginx.conf + ports: + - 8080:80 + networks: + - code-network + depends_on: + - php + + php: + build: + context: . + dockerfile: flarum-fpm.dockerfile + image: flarum-fpm:1 + volumes: + - ./:/var/www + networks: + - code-network + - db-network + depends_on: + - mariadb + + mariadb: + image: mariadb:10.4 + environment: + - MYSQL_ROOT_PASSWORD=rootpass + - MYSQL_DATABASE=flarum + - MYSQL_USER=flarum + - MYSQL_PASSWORD=flarumpass + volumes: + - db:/var/lib/mysql + networks: + - db-network + +networks: + code-network: + driver: bridge + db-network: + driver: bridge + +volumes: + db: \ No newline at end of file diff --git a/flarum-fpm.dockerfile b/flarum-fpm.dockerfile new file mode 100644 index 0000000..6c5e2a3 --- /dev/null +++ b/flarum-fpm.dockerfile @@ -0,0 +1,4 @@ +FROM php:7.2-fpm-alpine +RUN apk add libjpeg-turbo-dev libpng-dev freetype-dev +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ + && docker-php-ext-install -j$(nproc) gd pdo_mysql \ No newline at end of file diff --git a/nginx/flarum.conf b/nginx/flarum.conf new file mode 100644 index 0000000..0c3b6f6 --- /dev/null +++ b/nginx/flarum.conf @@ -0,0 +1,21 @@ +server { + listen 80; + index index.php index.html; + server_name localhost; + error_log /var/log/nginx/error.log; + access_log /var/log/nginx/access.log; + root /var/www/public; + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass php:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } + + include /etc/nginx/conf.d/.nginx.conf; + +} \ No newline at end of file