version: '3.8'

services:
  api:
    build: .
    container_name: api_slim
    ports:
      - "8080:80"  # Acceso a la API a través del puerto 8080 en el host
    volumes:
      - ./:/var/www/html  # Montamos el código fuente para facilitar el desarrollo (hot-reload)
    depends_on:
      - db

  db:
    image: mysql:8.0
    container_name: mysql_db
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: rootpassword
      MYSQL_DATABASE: tenderbuilding
      MYSQL_USER: user
      MYSQL_PASSWORD: userpassword
    ports:
      - "3306:3306"
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:
