Update docker-compose and Dockerfile for dev env

This change should ease the spawn of a development environment.
It can be used as a vscode devcontainer.

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf
2022-03-12 19:37:47 +01:00
parent 71ffcdc710
commit f51008aef0
13 changed files with 245 additions and 162 deletions

View File

@ -1,52 +1,64 @@
version: '2'
version: '3.8'
services:
nginx:
image: nginx:alpine
ports:
- "8000:80"
volumes:
- ./docker/nginx/nginx.conf:/nginx.conf
- ./docker/logs/nginx:/var/log/nginx
- .:/var/www/html
links:
- php:php
command: nginx -c /nginx.conf
php:
build:
context: docker/php
args:
# Set here your timezone using one of this: https://php.net/manual/en/timezones.php
timezone: 'Europe/Monaco'
ports:
- "9000:9000"
# Use target 'rootless' if you run rootless Docker
target: default
volumes:
- .:/var/www/html
#links:
# - "postgres:rdbms"
# - "mariadb:rdbms"
# Volumes for data-related folders
- assets:/var/www/html/web/assets
- data:/var/www/html/data
- cache:/var/www/.cache
# Uncomment the following volume if you run rootless Docker
# A limitation blocks permissions on root docker, see
# https://github.com/moby/moby/issues/40881
# - type: tmpfs
# target: /var/www/html/var/cache
# Override third-party libraries for dev
# - ../graby-site-config:/var/www/html/vendor/j0k3r/graby-site-config
# - ../php-readability:/var/www/html/vendor/j0k3r/php-readability
# - ../graby:/var/www/html/vendor/j0k3r/graby
# - ../HTMLawed:/var/www/html/vendor/fossar/htmlawed
# - ../PHPePub:/var/www/html/vendor/wallabag/phpepub
# - ../guzzle-site-authenticator:/var/www/html/vendor/bdunogier/guzzle-site-authenticator
env_file:
# Copy docker/php/env.example to docker/php/env and customize
- ./docker/php/env
# Comment non-used DBMS lines
# If all DBMS are commented out, sqlite will be used as default
# - ./docker/postgres/env
# Uncomment the database engine you want, it will use sqlite if both are commented
# - ./docker/mariadb/env
# - ./docker/postgres/env
# Uncomment to enable Xdebug
# - ./docker/php/xdebug
ports:
- 8000:8000
# Uncomment to permit Xdebug remote session
# - 9000:9000
depends_on:
# - mariadb
# - postgres
- redis
# postgres:
# image: postgres:11-alpine
# ports:
# - "5432:5432"
# volumes:
# - ./docker/data/pgsql:/var/lib/postgresql/data
# env_file:
# - ./docker/postgres/env
# image: postgres:11-alpine
# volumes:
# - db-data:/var/lib/postgresql/data
# env_file:
# - ./docker/postgres/env
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -q || exit 1"]
# interval: 10s
# timeout: 3s
# retries: 3
# mariadb:
# image: mariadb:10
# ports:
# - "3306:3306"
# volumes:
# - ./docker/data/mariadb:/var/lib/mysql
# - db-data:/var/lib/mysql
# env_file:
# - ./docker/mariadb/env
@ -56,6 +68,19 @@ services:
# - "15672:15672"
redis:
image: redis:4-alpine
ports:
- "6379:6379"
image: redis:6-alpine
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 3
volumes:
db-data:
driver: local
assets:
driver: local
data:
driver: local
cache:
driver: local