Update the docker configuration with an improveed one (WIP)

This commit is contained in:
Alex Tselegidis 2023-01-17 09:10:21 +01:00
parent 8449d5454c
commit a4c7a3b51d
7 changed files with 95 additions and 44 deletions

44
docker-compose.yml Normal file
View file

@ -0,0 +1,44 @@
version: '3.1'
services:
php-fpm:
build: docker/php-fpm
working_dir: /var/www/html
extra_hosts:
- host.docker.internal:host-gateway
volumes:
- '.:/var/www/html'
- './docker/php-fpm/php-ini-overrides.ini:/etc/php/8.0/fpm/conf.d/99-overrides.ini'
webserver:
image: 'nginx:alpine'
working_dir: /var/www/html
volumes:
- '.:/var/www/html'
- './docker/nginx/nginx.conf:/etc/nginx/conf.d/default.conf'
ports:
- '3000:80'
mysql:
image: 'mysql:8.0'
volumes:
- './docker/mysql:/var/lib/mysql'
environment:
- MYSQL_ROOT_PASSWORD=secret
- MYSQL_DATABASE=easyappointments
- MYSQL_USER=easyappointments
- MYSQL_PASSWORD=secret
ports:
- '3001:3306'
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- '3002:80'
environment:
- 'PMA_ARBITRARY=1'
mailhog:
image: 'mailhog/mailhog:latest'
ports:
- '3003:8025'

View file

@ -1,21 +0,0 @@
version: "3.1"
services:
mysql:
image: mysql:5.7
container_name: easyappointments-database
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_DATABASE=easyappointments
ports:
- "8001:3306"
server:
build: ./server
image: easyappointments-server:v1
container_name: easyappointments-server
ports:
- "8000:80"
volumes:
- ../:/var/www/html
- ./server/php.ini:/usr/local/etc/php/conf.d/99-overrides.ini

32
docker/nginx/nginx.conf Normal file
View file

@ -0,0 +1,32 @@
server {
listen 80 default;
server_name localhost;
client_max_body_size 108M;
access_log /var/log/nginx/application.access.log;
root /var/www/html/.;
index index.php;
# try to serve file directly, fallback to index.php
location / {
try_files $uri /index.php$is_args$args;
}
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
location ~ \.php$ {
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PHP_VALUE "error_log=/var/log/nginx/application_php_errors.log";
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
include fastcgi_params;
}
}

15
docker/php-fpm/Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM phpdockerio/php:8.0-fpm
WORKDIR "/var/www/html"
RUN apt-get update; \
apt-get -y --no-install-recommends install \
git \
php8.0-gd \
php8.0-intl \
php8.0-ldap \
php8.0-mcrypt \
php8.0-mysql \
php8.0-soap \
php8.0-xdebug; \
apt-get clean; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

View file

@ -0,0 +1,4 @@
upload_max_filesize = 100M
post_max_size = 108M
xdebug.mode = debug
xdebug.client_host = host.docker.internal

View file

@ -1,17 +0,0 @@
FROM php:7.4-apache
WORKDIR "/var/www/html"
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd gettext mysqli pdo_mysql
RUN pecl install xdebug \
&& docker-php-ext-enable xdebug
RUN a2enmod rewrite

View file

@ -1,6 +0,0 @@
date.timezone = UTC
upload_max_filesize = 100M
post_max_size = 100M
xdebug.remote_enable = on
xdebug.remote_host = host.docker.internal
max_execution_time = 0