feat: add backend CI/CD deployment

This commit is contained in:
hailt 2026-11-12 21:32:31 +07:00
parent 8d40cff227
commit 7c2e6ed571
21 changed files with 269 additions and 41 deletions

70
docker-compose.prod.yml Normal file
View file

@ -0,0 +1,70 @@
name: danagble-backend
services:
postgres:
image: postgres:16-alpine
container_name: danagble-postgres
restart: unless-stopped
env_file:
- ./backend.env
volumes:
- danagble_pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 10s
timeout: 5s
retries: 6
networks:
- danagble
redis:
image: redis:7-alpine
container_name: danagble-redis
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 6
networks:
- danagble
be:
image: danagble-be:latest
container_name: danagble-be
restart: unless-stopped
env_file:
- ./backend.env
expose:
- "8000"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
command: uvicorn src.main:app --host 0.0.0.0 --port 8000
healthcheck:
test:
- CMD
- python
- -c
- import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/api/v1/health', timeout=3)
interval: 10s
timeout: 5s
retries: 6
start_period: 20s
networks:
- danagble
- neuraagent
volumes:
danagble_pgdata:
networks:
danagble:
external: true
# Existing FE network name; rename only together with the FE production compose.
name: danangble_default
neuraagent:
external: true
name: neuraagent_neura-network