tasks/docker/compose.yml

94 lines
2.2 KiB
YAML
Raw Permalink Normal View History

name: tasks
services:
database:
container_name: ${COMPOSE_PROJECT_NAME}-database
build:
context: ..
dockerfile: ./docker/Dockerfile
target: database
args:
POSTGRESQL_VERSION: ${POSTGRESQL_VERSION:-17}
restart: always
shm_size: 128mb
volumes:
- database:/var/lib/postgresql/data
configs:
- source: db_config
target: /opt/tasks/database/config.sql
- source: db_loader
target: /docker-entrypoint-initdb.d/init-sql.sh
environment:
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD_FILE: /run/secrets/db_password
POSTGRES_PASSWORD_FILE: /run/secrets/pg_password
secrets:
- db_password
- pg_password
application:
build:
context: ..
dockerfile: ./docker/Dockerfile
target: application
args:
PHP_VERSION: ${PHP_VERSION:-8.3}
user: ${UID:-1000}:${GID:-1000}
configs:
- source: app_config
target: /var/www/tasks/includes/config.inc.php
environment:
BASE_URL: ${BASE_URL}
DB_HOST: database
DB_NAME: ${DB_NAME}
DB_USER: ${DB_USER}
DB_PASSWORD_FILE: /run/secrets/db_password
MEMCACHED_HOST: memcached
secrets:
- db_password
nginx:
image: nginx:${NGINX_VERSION:-1.19}-alpine
labels:
- traefik.enable=true
- traefik.http.routers.default.rule=Host(`${PHP_HOSTNAME:-localhost}`)
- traefik.port=80
volumes:
- ./nginx-templates:/etc/nginx/templates:ro
- ../site:/var/www/tasks/site:ro
memcached:
image: memcached:${MEMCACHED_VERSION:-1.6}-alpine
traefik:
container_name: ${COMPOSE_PROJECT_NAME}-traefik
image: traefik:${TRAEFIX_VERSION:-2.4}
ports:
- ${HOST_PORT}:80
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
command:
- --entrypoints.web.address=:80
- --log.level=DEBUG
- --providers.docker.exposedbydefault=false
- --providers.docker=true
configs:
app_config:
file: ./app-config.inc.php
db_config:
file: ./db-config.sql
db_loader:
file: ./init-sql.sh
volumes:
database:
secrets:
db_password:
environment: DB_PASSWORD
pg_password:
environment: PG_PASSWORD