From e515612412aba08abf7a14e7257ae512528ca53f Mon Sep 17 00:00:00 2001 From: Aldarien Date: Thu, 25 Mar 2021 21:24:03 -0300 Subject: [PATCH] Docker --- Dockerfile | 6 ++++++ docker-compose.yml | 46 ++++++++++++++++++++++++++++++++++++++++++++++ nginx.conf | 25 +++++++++++++++++++++++++ 3 files changed, 77 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ba1b508 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM php:7.4-fpm + +RUN docker-php-ext-install pdo pdo_mysql + +RUN pecl install xdebug-3.0.3 \ + && docker-php-ext-enable xdebug diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..ba91d4a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,46 @@ +version: '3' + +services: + web: + image: nginx:alpine + container_name: web + ports: + - 8080:80 + volumes: + - .:/code + - ./nginx.conf:/etc/nginx/conf.d/default.conf + + php: + build: . + container_name: php + ports: + - 9123:9000 + volumes: + - .:/code + + db: + container_name: db + image: mariadb:latest + restart: unless-stopped + ports: + - 3307:3306 + environment: + MYSQL_ROOT_PASSWORD: 'password' + MYSQL_DATABASE: 'incoviba' + MYSQL_USER: 'incoviba' + MYSQL_PASSWORD: '5GQYFvRjVw2A4KcD' + volumes: + - dbdata:/var/lib/mysql + + adminer: + container_name: adminer + image: adminer:latest + restart: unless-stopped + ports: + - 8082:8080 + environment: + ADMINER_DESIGN: 'dracula' + ADMINER_PLUGINS: 'dump-json' + +volumes: + dbdata: diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..8482eb6 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,25 @@ +server { + listen 80; + server_name web; + index index.php; + error_log /code/logs/error.log; + access_log /code/logs/access.log; + root /code/public; + + location /api { + try_files $uri /api/index.php$is_args$args; + } + location / { + try_files $uri /index.php$is_args$args; + } + + location ~ \.php { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param SCRIPT_NAME $fastcgi_script_name; + fastcgi_index index.php; + fastcgi_pass php:9000; + } +}