Files
----/docker-compose.yml

48 lines
1.2 KiB
YAML

services:
postgres:
image: postgres:16-alpine
container_name: cmdb-postgres
environment:
POSTGRES_DB: cmdb
POSTGRES_USER: cmdb
POSTGRES_PASSWORD: cmdb_secret
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
- ./backend/migrations/001_initial_schema.sql:/docker-entrypoint-initdb.d/001.sql
- ./backend/migrations/002_seed_data.sql:/docker-entrypoint-initdb.d/002.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cmdb"]
interval: 5s
timeout: 3s
retries: 5
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: cmdb-backend
environment:
DATABASE_URL: postgresql+asyncpg://cmdb:cmdb_secret@postgres:5432/cmdb
JWT_SECRET: ${JWT_SECRET:-super-secret-change-me}
CORS_ORIGINS: '["http://localhost:3000","http://localhost:80"]'
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: cmdb-frontend
ports:
- "80:80"
depends_on:
- backend
volumes:
pgdata: