geo/docker-compose.yml

117 lines
2.8 KiB
YAML

services:
db:
image: pgvector/pgvector:pg15
container_name: geo_db
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-geo_pg_dev_2026}
POSTGRES_DB: geo_platform
ports:
- "5433:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./docker/init-db:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d geo_platform"]
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 512m
cpus: '0.5'
reservations:
memory: 256m
redis:
image: redis:7-alpine
container_name: geo_redis
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD:-geo_redis_dev_2026} --appendonly yes
ports:
- "6380:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-geo_redis_dev_2026}", "ping"]
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
memory: 128m
cpus: '0.25'
reservations:
memory: 64m
backend:
build:
context: ./backend
dockerfile: Dockerfile
target: ${BACKEND_TARGET:-runtime}
container_name: geo_backend
restart: unless-stopped
ports:
- "8000:8000"
env_file:
- .env
environment:
DATABASE_URL: postgresql+asyncpg://postgres:${POSTGRES_PASSWORD:-geo_pg_dev_2026}@db:5432/geo_platform
REDIS_URL: redis://:${REDIS_PASSWORD:-geo_redis_dev_2026}@redis:6379/0
volumes:
- ./backend:/app
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy
command: uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
interval: 30s
timeout: 10s
start_period: 30s
retries: 3
deploy:
resources:
limits:
memory: 512m
cpus: '1.0'
reservations:
memory: 256m
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
target: ${FRONTEND_TARGET:-development}
container_name: geo_frontend
restart: unless-stopped
ports:
- "3000:3000"
env_file:
- .env
environment:
NEXT_PUBLIC_API_URL: http://localhost:8000
volumes:
- ./frontend:/app
- frontend_node_modules:/app/node_modules
depends_on:
- backend
command: npm run dev
deploy:
resources:
limits:
memory: 256m
cpus: '0.5'
reservations:
memory: 128m
volumes:
postgres_data:
redis_data:
frontend_node_modules: