version: "3.8"

services:
  nextjs-app:
    container_name: mwitnessing-app
    build:
      context: ..
      dockerfile: _deploy/standard.Dockerfile
    restart: always
    ports:
      - "3000:3000"
    environment:
      - DATABASE_URL=mysql://mwitnessing_user:password@db:3306/mwitnessing
      - NEXTAUTH_URL=http://localhost:3000
      - NEXTAUTH_SECRET=your-nextauth-secret
    volumes:
      - app_permits:/app/public/content/permits
      - app_uploads:/app/public/content/uploads
      - app_logs:/app/logs
    depends_on:
      - db
    networks:
      - app-network

  db:
    container_name: mwitnessing-db
    image: mysql:8.0
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=rootpassword
      - MYSQL_DATABASE=mwitnessing
      - MYSQL_USER=mwitnessing_user
      - MYSQL_PASSWORD=password
    volumes:
      - db_data:/var/lib/mysql
    ports:
      - "3306:3306"
    networks:
      - app-network
    command: --default-authentication-plugin=mysql_native_password

  adminer:
    container_name: mwitnessing-adminer
    image: adminer:latest
    restart: always
    ports:
      - "8080:8080"
    depends_on:
      - db
    networks:
      - app-network

volumes:
  app_permits:
    driver: local
  app_uploads:
    driver: local
  app_logs:
    driver: local
  db_data:
    driver: local

networks:
  app-network:
    driver: bridge 