Files
RekomenciBackend/compose.yaml
T
2025-11-17 21:49:01 +03:00

246 lines
5.7 KiB
YAML

services:
backend:
image: template-project-backend
build:
context: .
dockerfile: Containerfile
target: runtime
tags:
- template-project-backend:latest
pull: true
depends_on:
migrations:
restart: false
condition: service_completed_successfully
required: false
postgres:
restart: false
condition: service_healthy
required: true
redis:
restart: false
condition: service_healthy
required: true
configs:
- source: backend_config
target: /app/config.toml
env_file:
- path: ./infrastructure/configs/backend/.env.template
required: true
- path: ./infrastructure/configs/backend/.env
required: false
networks:
- default
ports:
- name: web
target: 8080
published: 13560
host_ip: 127.0.0.1
protocol: tcp
app_protocol: http
restart: unless-stopped
shm_size: 4mb
tests:
image: template-project-tests
build:
context: .
dockerfile: Containerfile
target: tests
tags:
- template-project-tests:latest
pull: true
depends_on:
backend:
restart: false
condition: service_healthy
required: true
migrations:
restart: false
condition: service_completed_successfully
required: true
postgres:
restart: false
condition: service_healthy
required: true
redis:
restart: false
condition: service_healthy
required: true
configs:
- source: backend_config
target: /app/config.toml
- source: alembic_config
target: /app/alembic.ini
env_file:
- path: ./infrastructure/configs/backend/.env.template
required: true
- path: ./infrastructure/configs/backend/.env
required: false
networks:
- default
profiles:
- tests
restart: no
shm_size: 4mb
volumes:
- type: bind
source: ./.cov
target: /app/cov
migrations:
image: template-project-migrations
build:
context: .
dockerfile: Containerfile
target: migrations
tags:
- template-project-migrations:latest
pull: true
depends_on:
postgres:
restart: false
condition: service_healthy
required: true
configs:
- source: backend_config
target: /app/config.toml
- source: alembic_config
target: /app/alembic.ini
env_file:
- path: ./infrastructure/configs/backend/.env.template
required: true
- path: ./infrastructure/configs/backend/.env
required: false
networks:
- default
profiles:
- migrations
restart: no
shm_size: 4mb
postgres:
image: docker.io/postgres:17-alpine
configs:
- source: postgres_config
target: /etc/postgresql/postgresql.conf
env_file:
- path: ./infrastructure/configs/postgres/.env.template
required: true
- path: ./infrastructure/configs/postgres/.env
required: false
healthcheck:
test: [ "CMD", "pg_isready", "--dbname=postgres" ]
interval: 1m30s
timeout: 5s
start_period: 5s
start_interval: 2s
retries: 5
networks:
- default
oom_kill_disable: true
restart: unless-stopped
shm_size: 128mb
volumes:
- type: volume
source: postgres_data
target: /var/lib/postgresql/data
pgadmin:
image: docker.io/dpage/pgadmin4:9
configs:
- source: pgadmin_servers_config
target: /pgadmin4/servers.json
depends_on:
postgres:
restart: false
condition: service_healthy
required: true
env_file:
- path: ./infrastructure/configs/pgadmin/.env.template
required: true
- path: ./infrastructure/configs/pgadmin/.env
required: false
healthcheck:
test: [ "CMD", "wget", "-O", "-", "http://localhost:80/misc/ping" ]
interval: 1m30s
timeout: 5s
start_period: 5s
start_interval: 2s
retries: 5
ports:
- name: web
target: 80
published: 13561
host_ip: 127.0.0.1
protocol: tcp
app_protocol: http
networks:
- default
profiles:
- observability
restart: unless-stopped
shm_size: 4mb
volumes:
- type: volume
source: pgadmin_data
target: /var/lib/pgadmin
read_only: false
redis:
image: docker.io/redis:8-alpine
command: redis-server /usr/local/etc/redis/redis.conf
configs:
- source: redis_config
target: /usr/local/etc/redis/redis.conf
env_file:
- path: ./infrastructure/configs/redis/.env.template
required: true
- path: ./infrastructure/configs/redis/.env
required: false
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 1m30s
timeout: 5s
start_period: 5s
start_interval: 2s
retries: 5
networks:
- default
restart: unless-stopped
shm_size: 4mb
volumes:
- type: volume
source: redis_data
target: /data
read_only: false
networks:
default:
driver: bridge
name: $COMPOSE_PROJECT_NAME
attachable: false
enable_ipv4: true
enable_ipv6: true
internal: false
external: false
volumes:
postgres_data:
pgadmin_data:
redis_data:
configs:
backend_config:
file: ./infrastructure/configs/backend/config.toml
alembic_config:
file: alembic.ini
postgres_config:
file: ./infrastructure/configs/postgres/postgresql.conf
pgadmin_servers_config:
file: ./infrastructure/configs/pgadmin/servers.json
redis_config:
file: ./infrastructure/configs/redis/redis.conf