version: '3.8'

services:
  homework-backend:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "8080:8080"
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=http://+:8080
    volumes:
      - ./Homework/Logs:/app/Logs
    networks:
      - homework-network
    depends_on:
      - postgres
    restart: unless-stopped

  postgres:
    image: postgres:15-alpine
    environment:
      - POSTGRES_DB=homework
      - POSTGRES_USER=homework_user
      - POSTGRES_PASSWORD=homework_password
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql
    networks:
      - homework-network
    restart: unless-stopped

volumes:
  postgres_data:

networks:
  homework-network:
    driver: bridge