133 lines
3.4 KiB
YAML
133 lines
3.4 KiB
YAML
name: excel-project
|
|
|
|
services:
|
|
backend-dev:
|
|
profiles: ["dev"]
|
|
image: "${DOCKER_REGISTRY:-local}/excel-dev:${IMAGE_TAG:-local}"
|
|
container_name: backend-dev
|
|
build:
|
|
dockerfile: ./docker/dockerfile
|
|
context: ../
|
|
target: dev
|
|
init: true #Manage processes and reap zombies
|
|
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
|
|
environment:
|
|
- DB_HOST=psql
|
|
volumes:
|
|
- type: bind
|
|
source: ../src
|
|
target: /home/excel-project/src
|
|
- type: bind
|
|
source: ../main.py
|
|
target: /home/excel-project/main.py
|
|
- type: bind
|
|
source: ../configs
|
|
target: /home/excel-project/configs
|
|
- type: bind
|
|
source: ../DB
|
|
target: /home/excel-project/DB
|
|
- type: bind
|
|
source: ../uploads
|
|
target: /home/excel-project/uploads
|
|
- type: bind
|
|
source: ../logs
|
|
target: /home/excel-project/logs
|
|
networks:
|
|
- backend
|
|
depends_on:
|
|
psql:
|
|
condition: service_healthy
|
|
migration:
|
|
condition: service_completed_successfully
|
|
ports:
|
|
- "80:8000"
|
|
entrypoint: ["./entrypoint.sh", "--dev"]
|
|
|
|
backend-prod:
|
|
profiles: ["prod"]
|
|
image: "${DOCKER_REGISTRY:-local}/excel-prod:${IMAGE_TAG:-local}"
|
|
container_name: backend-prod
|
|
build:
|
|
dockerfile: ./docker/dockerfile
|
|
context: ../
|
|
target: prod
|
|
init: true #Manage processes and reap zombies
|
|
ipc: private #Inter-Process Communication (IPC) namespace for high-performance applications
|
|
environment:
|
|
- DB_HOST=psql
|
|
volumes:
|
|
- type: bind
|
|
source: ../configs
|
|
target: /home/excel-project/configs
|
|
- type: bind
|
|
source: ../DB
|
|
target: /home/excel-project/DB
|
|
- type: bind
|
|
source: ../uploads
|
|
target: /home/excel-project/uploads
|
|
- type: bind
|
|
source: ../logs
|
|
target: /home/excel-project/logs
|
|
networks:
|
|
- backend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
psql:
|
|
condition: service_healthy
|
|
migration:
|
|
condition: service_completed_successfully
|
|
ports:
|
|
- "80:8000"
|
|
|
|
psql:
|
|
profiles: ["prod", "dev", "db"]
|
|
image: postgres:16-alpine
|
|
container_name: psql
|
|
init: true
|
|
ipc: private
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
|
POSTGRES_DB: ${DB_POSTGRESS}
|
|
volumes:
|
|
- type: bind
|
|
source: ../DB
|
|
target: /var/lib/postgresql/data
|
|
networks:
|
|
- backend
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_POSTGRESS}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
ports:
|
|
- "5432:5432"
|
|
|
|
|
|
migration:
|
|
profiles: ["prod", "dev"]
|
|
image: "${DOCKER_REGISTRY:-local}/migration-tool:${IMAGE_TAG:-local}"
|
|
build:
|
|
dockerfile: ./docker/dockerfile
|
|
context: ../
|
|
target: migration-tool
|
|
environment:
|
|
- DB_HOST=psql
|
|
volumes:
|
|
- type: bind
|
|
source: ../configs
|
|
target: /home/excel-project/configs
|
|
- type: bind
|
|
source: ../src/migrations
|
|
target: /home/excel-project/src/migrations
|
|
|
|
depends_on:
|
|
- psql
|
|
networks:
|
|
- backend
|
|
|
|
|
|
networks:
|
|
backend:
|
|
name: "${BACKEND_NETWORK:-backend_network}" |