Some checks failed
api-ci-deploy / test-build-deploy (push) Has been cancelled
- Add init service behind --profile init with cc-api-dev:latest image - Remove build sections from backend-dev and backend-test (pre-built images) - Add env var comments referencing .env.example - Standardize INIT_MODE=infra default, RUN_INIT=true for init service
77 lines
2.0 KiB
YAML
77 lines
2.0 KiB
YAML
services:
|
|
# ── Required environment variables (see .env.example) ───────────────────────
|
|
# APP_BOLT_URL, USER_NEO4J, PASSWORD_NEO4J — Neo4j connection
|
|
# SUPABASE_URL, SERVICE_ROLE_KEY — Supabase project
|
|
# REDIS_HOST, REDIS_PORT, REDIS_PASSWORD — Redis (optional auth)
|
|
# FASTAPI_SECRET_KEY, ADMIN_EMAIL — API config
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: classroomcopilot-redis
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis-data:/data
|
|
command: redis-server --appendonly yes
|
|
networks:
|
|
- kevlarai-network
|
|
healthcheck:
|
|
test: [ "CMD", "redis-cli", "ping" ]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
# Initialization service - runs setup tasks before backend starts
|
|
init:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: api-init
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- REDIS_HOST=redis
|
|
- RUN_INIT=true
|
|
- INIT_MODE=${INIT_MODE:-infra} # Set via .env or override: INIT_MODE=infra,gais-data
|
|
- INIT_ONLY=true # Exit after init, don't start server
|
|
command: [ "./docker-entrypoint.sh", "init-only" ]
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- kevlarai-network
|
|
profiles:
|
|
- init # Only run when explicitly requested: docker compose --profile init up
|
|
|
|
backend:
|
|
container_name: api
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
- REDIS_HOST=redis
|
|
- START_MODE=prod
|
|
- APP_ENV=production
|
|
- ENVIRONMENT=production
|
|
- CC_COMPOSE_PROJECT=api
|
|
- CC_COMPOSE_SERVICE=backend
|
|
- RUN_INIT=${RUN_INIT:-false} # Set to 'true' to run init on startup
|
|
- INIT_MODE=${INIT_MODE:-infra} # Which init tasks to run
|
|
ports:
|
|
- 8000:8000
|
|
depends_on:
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- kevlarai-network
|
|
|
|
volumes:
|
|
redis-data:
|
|
|
|
|
|
networks:
|
|
kevlarai-network:
|
|
name: kevlarai-network
|
|
driver: bridge
|