docker-compose.yml 1.85 KB
services:
  postgres:
    image: postgres:16-alpine
    container_name: rps-postgres
    command: ["postgres", "-p", "15432"]
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-robot_production_system}
      POSTGRES_USER: ${POSTGRES_USER:-robot}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-robot}
    ports:
      - "${POSTGRES_PORT:-15432}:15432"
    volumes:
      - rps-postgres-data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -p 15432 -U ${POSTGRES_USER:-robot} -d ${POSTGRES_DB:-robot_production_system}"]
      interval: 5s
      timeout: 5s
      retries: 10

  backend:
    build:
      context: .
      dockerfile: backend/Dockerfile
    container_name: rps-backend
    restart: unless-stopped
    environment:
      ASPNETCORE_ENVIRONMENT: ${ASPNETCORE_ENVIRONMENT:-Production}
      ASPNETCORE_URLS: ${ASPNETCORE_URLS:-http://+:8000}
      ConnectionStrings__DefaultConnection: Host=postgres;Port=15432;Database=${POSTGRES_DB:-robot_production_system};Username=${POSTGRES_USER:-robot};Password=${POSTGRES_PASSWORD:-robot}
      FileStorage__UploadsRoot: /app/uploads
    ports:
      - "${BACKEND_PORT:-8000}:8000"
    volumes:
      - rps-uploads-data:/app/uploads
    depends_on:
      postgres:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-fsS", "http://localhost:8000/health"]
      interval: 10s
      timeout: 5s
      retries: 10

  frontend:
    build:
      context: ./frontend
      dockerfile: Dockerfile
      args:
        NUXT_PUBLIC_API_BASE: ${NUXT_PUBLIC_API_BASE:-/api}
    container_name: rps-frontend
    restart: unless-stopped
    depends_on:
      backend:
        condition: service_healthy
    ports:
      - "${FRONTEND_PORT:-8080}:80"
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro

volumes:
  rps-postgres-data:
  rps-uploads-data: