version: '3.8'

services:
  postgres:
    image: postgres:15-alpine
    container_name: fps_db
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
      POSTGRES_DB: fps_1v1
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./backend/src/db/schema.sql:/docker-entrypoint-initdb.d/schema.sql
    networks:
      - fps_network

  backend:
    build:
      context: ./backend
      dockerfile: Dockerfile
    container_name: fps_backend
    environment:
      PORT: 3000
      DATABASE_URL: postgresql://postgres:password@postgres:5432/fps_1v1
      NODE_ENV: production
    ports:
      - "3000:3000"
    depends_on:
      - postgres
    networks:
      - fps_network

volumes:
  postgres_data:

networks:
  fps_network:
    driver: bridge
