OS: Ubuntu 22.04.4 LTS
Docker: Docker version 25.0.3, build 4debf41
docker-compose.yml:
version: '3.5'
services:
nginx:
image: 'nginx:1.21-alpine'
container_name: '${DOCKER_STACK}_nginx'
restart: always
working_dir: /var/www
volumes:
- './../:/var/www'
- './docker/nginx.conf:/etc/nginx/conf.d/default.conf'
networks:
- default
- web
fpm:
build:
context: ./docker
dockerfile: fpm-bullseye.dockerfile
container_name: '${DOCKER_STACK}_fpm'
extra_hosts:
- "host.docker.internal:host-gateway"
ports:
- "9003:9003"
restart: always
working_dir: /var/www
env_file: .env
volumes:
- './../:/var/www'
- './docker/xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini'
- './docker/error_reporting.ini:/usr/local/etc/php/conf.d/error_reporting.ini'
networks:
- default
xdebug.ini:
zend_extension=xdebug
[xdebug]
xdebug.mode=develop,debug
xdebug.client_host=host.docker.internal
xdebug.start_with_request=yes
xdebug.log=/tmp/xdebug.log
xdebug.log_level=10
error_reporting.ini:
error_reporting=E_ALL
nginx.conf:
server {
listen 80;
listen [::]:80;
root /var/www/public;
index index.php index.html;
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_types application/json application/xml application/x-javascript application/javascript text/javascript text/css;
gzip_vary on;
add_header X-Content-Type-Options "nosniff";
add_header X-Frame-Options "SAMEORIGIN";
client_max_body_size 4m;
location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
location ~* \.(js|css|png|jpe?g|gif|ico|svg|woff|woff2)$ {
expires 30d;
access_log off;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php?$args;
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass fpm:9000;
fastcgi_index index.php;
fastcgi_param PHP_VALUE "expose_php=0
memory_limit=128M
post_max_size=16M
upload_max_filesize=16M
max_execution_time=60
max_input_time=60
log_errors=On
error_log=/dev/stderr";
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SERVER_NAME $host;
}
}
}
Dockerfile:
FROM php:8.0.29-fpm-bullseye
RUN apt-get update -y && \
apt-get -y install --no-install-recommends whiptail libtidy-dev apt-utils libicu-dev git gcc make autoconf libc-dev pkg-config libzip-dev
# # Xdebug
RUN pecl install xdebug-3.2.2 && docker-php-ext-enable xdebug
# Cleanup
RUN apt-get remove -y git && \
apt-get autoremove -y && \
apt-get clean && \
rm -rf /etc/cron.*/* && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Cron hack
RUN touch /tmp/run_scheduler
|