version: '3.8' # Use a recent version services: # --- Web API --- api: build: context: . ssh: ["default"] container_name: schedtxt_api ports: - "9081:9081" env_file: - .env depends_on: main_db: condition: service_healthy networks: - schedtxt_api-network restart: unless-stopped # --- Auth API --- auth_api: build: context: ../schedtxt_auth ssh: ["default"] dockerfile: Dockerfile container_name: auth_api restart: unless-stopped ports: - "9080:9080" env_file: - ../schedtxt_auth/.env depends_on: auth_db: condition: service_healthy networks: - schedtxt_api-network # --- catapult service --- catapult: build: context: ../catapult ssh: ["default"] dockerfile: Dockerfile container_name: catapult restart: unless-stopped env_file: - ../catapult/.env depends_on: - api - main_db - auth_api - auth_db networks: - schedtxt_api-network # PostgreSQL Database Service main_db: image: postgres:18.4-alpine container_name: schedtxt_api_db environment: # These MUST match the user, password, and database name in the DATABASE_URL above POSTGRES_USER: ${DB_MAIN_USER:-schedtxt_api} POSTGRES_PASSWORD: ${DB_MAIN_PASSWORD:-password} POSTGRES_DB: ${DB_MAIN_NAME:-schedtxt_api_db} volumes: - postgres_data:/var/lib/postgresql ports: - "5432:5432" healthcheck: # Checks if Postgres is ready to accept connections test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] interval: 10s timeout: 5s retries: 5 start_period: 10s restart: always networks: - schedtxt_api-network # --- schedtxt_api web auth api db --- auth_db: image: postgres:18.4-alpine container_name: schedtxt_api_auth_db environment: # These MUST match the user, password, and database name in the DATABASE_URL above POSTGRES_USER: ${DB_AUTH_USER:-schedtxt_auth} POSTGRES_PASSWORD: ${DB_AUTH_PASSWORD:-password} POSTGRES_DB: ${DB_AUTH_NAME:-schedtxt_auth_db} volumes: # Persist database data using a named volume - postgres_data_auth:/var/lib/postgresql ports: - "5433:5432" healthcheck: # Checks if Postgres is ready to accept connections test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] interval: 10s timeout: 5s retries: 5 start_period: 10s restart: always networks: - schedtxt_api-network volumes: postgres_data: driver: local postgres_data_auth: driver: local networks: schedtxt_api-network: driver: bridge