Update: php version. moved Docker files to dist.

This commit is contained in:
Stan Yakubenko 2021-02-05 21:03:29 +05:00
parent fdd0b26c54
commit cf0a4f403b
15 changed files with 2067 additions and 17 deletions

View File

@ -1,5 +1,5 @@
PROJECT_DIR=.
# all container will be appended with this
# all containers' names will be appended with this
APP_NAME=dev_station
# default user/password pair for all services
APP_USER=user
@ -18,3 +18,5 @@ XDEBUG_PORT=9001
XDEBUG_IDE=VSCODE
#webroot dir
WEB_ROOT=/var/www/public
#php host
PHP_HOST=phpfpm8

View File

@ -11,8 +11,11 @@ status: ## Show status of containers
up: ## Start all or c=<name> containers in foreground
@$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) up $(c)
shell: ## Start all or c=<name> containers in foreground
@$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) exec $(c) $(sh)
build: ## Start all or c=<name> containers in foreground
@$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) build $(c)
cmd: ## Start all or c=<name> containers in foreground
@$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) exec $(c) $(cmd)
start: ## Start all or c=<name> containers in background
@$(DOCKER_COMPOSE) -f $(DOCKER_COMPOSE_FILE) --env-file $(ENV_FILE) up -d $(c)

View File

@ -6,7 +6,7 @@ services:
container_name: nginx_${APP_NAME}
restart: 'no'
depends_on:
- phpfpm
- ${PHP_HOST}
ports:
- ${NGINX_PORT}:80
volumes:
@ -14,9 +14,15 @@ services:
- ${PROJECT_DIR}:/var/www
environment:
WEB_ROOT: ${WEB_ROOT}
# this allows you to switch versions
# use the name of a php service presented in this file
# in your .env
PHP_HOST: ${PHP_HOST}
phpfpm:
build: ./docker/php-fpm/
build:
context: ./docker/php-fpm/
dockerfile: Dockerfile.dist
container_name: phpfpm_${APP_NAME}
restart: 'no'
volumes:
@ -33,9 +39,32 @@ services:
XDEBUG_PORT: ${XDEBUG_PORT}
XDEBUG_HOST: ${XDEBUG_HOST}
XDEBUG_IDE: ${XDEBUG_IDE}
working_dir: /var/www
phpfpm8:
build:
context: ./docker/php-fpm8/
dockerfile: Dockerfile.dist
container_name: phpfpm8_${APP_NAME}
restart: 'no'
volumes:
- ${PROJECT_DIR}:/var/www
- ./docker/php-fpm8/php.ini:/etc/php/8.0/php.ini
- ./docker/php-fpm8/xdebug.ini:/etc/php/8.0/mods-available/xdebug.ini
- ./docker/php-fpm8/supervisor.conf:/etc/supervisor/supervisor_nodeamon.conf
- ./docker/imagick/policy.xml:/etc/ImageMagick-6/policy.xml
# One can add any configuration overrides.
# Just put them under ./docker/userconfigs/
# and map as following
# - ./docker/userconfigs/supervisor/conf.d:/etc/supervisor/conf.d
environment:
XDEBUG_PORT: ${XDEBUG_PORT}
XDEBUG_HOST: ${XDEBUG_HOST}
XDEBUG_IDE: ${XDEBUG_IDE}
working_dir: /var/www
postgres:
image: postgis/postgis:12-master
image: postgis/postgis:13-master
container_name: postgis_${APP_NAME}
restart: 'no'
ports:

View File

@ -17,8 +17,12 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass phpfpm:9000;
fastcgi_buffering off;
fastcgi_pass ${PHP_HOST}:9000;
fastcgi_buffering on;
fastcgi_buffer_size 512k;
fastcgi_buffers 4 512k;
internal;
}
error_log stderr warn;

1
docker/php-fpm/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
Dockerfile

View File

@ -1,5 +1,7 @@
[supervisord]
nodaemon=true
pidfile = /tmp/supervisord.pid
logfile = /tmp/supervisord.log
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)

View File

@ -1,13 +1,11 @@
zend_extension=xdebug.so
[xdebug]
xdebug.remote_autostart = 1
xdebug.remote_enable = on
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = on
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir ="/tmp"
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = ${XDEBUG_PORT}
xdebug.output_dir ="/tmp"
xdebug.show_local_vars=1
xdebug.remote_port=${XDEBUG_PORT}
xdebug.remote_host=${XDEBUG_HOST}
xdebug.client_host=${XDEBUG_HOST}
xdebug.idekey=${XDEBUG_IDE}
xdebug.log=/tmp/xdebug.log
xdebug.log_level = 0

View File

@ -0,0 +1 @@
alias c="clear"

1
docker/php-fpm8/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
Dockerfile

View File

@ -0,0 +1,9 @@
FROM phpdockerio/php80-fpm
RUN apt-get update
RUN apt-get install -y supervisor iputils-ping libboost-dev libxml2-dev
RUN apt-get install -y php8.0-curl php8.0-mbstring php8.0-xml php8.0-intl \
php8.0-zip php8.0-xdebug php8.0-pgsql php8.0-bcmath php8.0-amqp \
php-imagick php8.0-gmp php8.0-redis
CMD ["supervisord", "-c", "/etc/supervisor/supervisor_nodeamon.conf"]

View File

@ -0,0 +1,20 @@
[global]
; Override default pid file
pid = /run/php-fpm.pid
; Avoid logs being sent to syslog
error_log = /proc/self/fd/2
[www]
# user = webuser
# group = webuser
; Access from webserver container is via network, not socket file
listen = [::]:9000
; Redirect logs to stdout - FPM closes /dev/std* on startup
access.log = /proc/self/fd/2
catch_workers_output = yes
; Required to allow config-by-environment
clear_env = no

1946
docker/php-fpm8/php.ini Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
[supervisord]
nodaemon=true
pidfile = /tmp/supervisord.pid
logfile = /tmp/supervisord.log
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[program:php-fpm]
command=/usr/sbin/php-fpm8.0
autostart = true
autorestart = false
stopasgroup=true
[include]
files = /etc/supervisor/conf.d/*.conf

View File

@ -0,0 +1,11 @@
zend_extension=xdebug.so
[xdebug]
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = ${XDEBUG_PORT}
xdebug.output_dir ="/tmp"
xdebug.show_local_vars=1
xdebug.client_host=${XDEBUG_HOST}
xdebug.idekey=${XDEBUG_IDE}
xdebug.log=/tmp/xdebug.log
xdebug.log_level = 0