services:
  #GYM BACKEND
  gym_laravel:
    build:
      context: ./laravel
    container_name: gym_laravel
    volumes:
      - ./laravel:/var/www
      - ./database/rep_radar.sqlite:/var/www/database/rep_radar.sqlite
    working_dir: /var/www
    expose:
      - "9000"   # expose php-fpm port internally to other containers
    depends_on:
      - gym_frontend

  # GYM FRONTEND
  gym_frontend:
    build:
      dockerfile: Dockerfile
      context: ./frontend
    container_name: gym_frontend
    ports:
      - "8080:80"

  # GYM NGINX
  gym_nginx:
    image: nginx:latest
    container_name: gym_nginx
    ports:
      - "9000:80"   # host port 9000 → nginx container port 80
    volumes:
      - ./laravel:/var/www   # serve code to nginx
      - ./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro
    depends_on:
      - gym_laravel