services:
  app:
    build: .
    image: hr-app:latest
    container_name: hr-app
    restart: always
    env_file:
      - .env
    depends_on:
    - mysql
    expose:
      - "8000"  # PHP-FPM listens on this port internally
    networks:
      - hrnet

  web:
    image: nginx:alpine
    container_name: hr-nginx
    restart: always
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      - .:/app:ro
    depends_on:
      - app
    ports:
      - "980:80"
    networks:
      - hrnet

  mysql:
    image: mysql:latest
    container_name: hr-mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ben
      MYSQL_DATABASE: hr
      MYSQL_USER: hruser
      MYSQL_PASSWORD: hrpass
    expose:
      - "3306"
    volumes:
      - mysql-data:/var/lib/mysql
    networks:
      - hrnet

volumes:
  mysql-data:
networks:
  hrnet: