version: "3.9"

services:
  api:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: orderop-api
    ports:
      - "${API_PORT:-8000}:80"
    env_file: .env
    volumes:
      - api-storage:/var/www/html/storage
    depends_on:
      - mysql
    restart: unless-stopped

  mysql:
    image: mysql:8.0
    container_name: orderop-mysql
    ports:
      - "${MYSQL_PORT:-3306}:3306"
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-rootpass}
      MYSQL_DATABASE: ${DB_DATABASE:-orderop}
      MYSQL_USER: ${DB_USERNAME:-orderop_user}
      MYSQL_PASSWORD: ${DB_PASSWORD:-orderop_pass}
    volumes:
      - mysql-data:/var/lib/mysql
    restart: unless-stopped

volumes:
  api-storage:
  mysql-data:


