services: # ========================================================================= # Infrastructure # ========================================================================= postgres: image: postgres:16-alpine restart: unless-stopped ports: - "127.0.0.1:5432:5432" environment: POSTGRES_USER: ${POSTGRES_USER:-gitgram} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD} POSTGRES_DB: ${POSTGRES_DB:-gitgram} volumes: - postgres_data:/var/lib/postgresql/data healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-gitgram}"] interval: 10s timeout: 5s retries: 5 deploy: resources: limits: memory: 512M logging: driver: json-file options: max-size: "10m" max-file: "3" redis: image: redis:7-alpine restart: unless-stopped ports: - "127.0.0.1:6379:6379" volumes: - redis_data:/data healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 5 deploy: resources: limits: memory: 256M logging: driver: json-file options: max-size: "10m" max-file: "3" # ========================================================================= # Gitgram # ========================================================================= gitgram-backend: build: context: ./gitgram/backend dockerfile: Dockerfile restart: unless-stopped ports: - "127.0.0.1:4000:4000" env_file: - .env.gitgram environment: NODE_ENV: production PORT: 4000 DATABASE_URL: postgresql://${POSTGRES_USER:-gitgram}:${POSTGRES_PASSWORD}@postgres:5432/${POSTGRES_DB:-gitgram} REDIS_URL: redis://redis:6379 depends_on: postgres: condition: service_healthy redis: condition: service_healthy healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:4000/health"] interval: 30s timeout: 5s retries: 3 start_period: 15s deploy: resources: limits: memory: 512M logging: driver: json-file options: max-size: "10m" max-file: "3" gitgram-web: build: context: ./gitgram/web dockerfile: Dockerfile restart: unless-stopped ports: - "127.0.0.1:3000:3000" env_file: - .env.gitgram-web environment: NODE_ENV: production PORT: 3000 depends_on: gitgram-backend: condition: service_healthy healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:3000/"] interval: 30s timeout: 5s retries: 3 start_period: 15s deploy: resources: limits: memory: 256M logging: driver: json-file options: max-size: "10m" max-file: "3" # ========================================================================= # AITimeMachine # ========================================================================= aitm-api: build: context: ./aitimemachine/api-server dockerfile: Dockerfile restart: unless-stopped ports: - "127.0.0.1:3001:3001" env_file: - .env.aitm-api environment: NODE_ENV: production PORT: 3001 # DATABASE_URL is intentionally provided by .env.aitm-api (or the host environment), # so production can use Neon without compose overriding it. depends_on: postgres: condition: service_healthy healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:3001/health"] interval: 30s timeout: 5s retries: 3 start_period: 15s deploy: resources: limits: memory: 512M logging: driver: json-file options: max-size: "10m" max-file: "3" aitm-website: build: context: ./aitimemachine/website dockerfile: Dockerfile restart: unless-stopped ports: - "127.0.0.1:3002:3002" env_file: - .env.aitm-website environment: NODE_ENV: production PORT: 3002 depends_on: aitm-api: condition: service_healthy healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:3002/"] interval: 30s timeout: 5s retries: 3 start_period: 15s deploy: resources: limits: memory: 256M logging: driver: json-file options: max-size: "10m" max-file: "3" volumes: postgres_data: redis_data: