services: redis: image: redis:8-alpine command: ["redis-server", "--save", "", "--appendonly", "no"] ports: - "127.0.0.1:${REDIS_PORT:-6379}:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 5s retries: 10 postgres: image: postgres:17-alpine environment: POSTGRES_DB: ${POSTGRES_DB} POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} ports: - "127.0.0.1:${POSTGRES_PORT:-5433}:5432" volumes: - fibrex_postgres:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 5s retries: 10 migrate: image: postgres:17-alpine depends_on: postgres: condition: service_healthy volumes: - ./api/migrations:/migrations:ro environment: PGPASSWORD: ${POSTGRES_PASSWORD} command: - /bin/sh - -c - for migration in /migrations/*.sql; do psql -v ON_ERROR_STOP=1 -h postgres -U ${POSTGRES_USER} -d ${POSTGRES_DB} -f "$$migration"; done restart: "no" api: build: context: ./api dockerfile: Dockerfile.api env_file: - .env environment: API_ADDRESS: 0.0.0.0:8080 DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable REDIS_URL: redis://redis:6379/0 depends_on: postgres: condition: service_healthy redis: condition: service_healthy migrate: condition: service_completed_successfully restart: unless-stopped healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8080/api/v1/health"] interval: 10s timeout: 5s retries: 5 start_period: 10s worker: build: context: ./api dockerfile: Dockerfile.worker env_file: - .env environment: DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB}?sslmode=disable depends_on: postgres: condition: service_healthy migrate: condition: service_completed_successfully restart: unless-stopped web: build: context: ./web dockerfile: Dockerfile depends_on: api: condition: service_healthy ports: - "127.0.0.1:${WEB_PORT:-5173}:80" restart: unless-stopped healthcheck: test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1/healthz"] interval: 10s timeout: 5s retries: 5 volumes: fibrex_postgres: