version: '3.8'

services:
  app:
    build:
      context: .
      dockerfile: Dockerfile
    ports:
      - "${APP_PORT}:${APP_PORT}"
    env_file:
      - .env.development # Gunakan .env.production jika ingin menggunakan lingkungan produksi
    depends_on:
      - db
    volumes:
      - .:/app
    networks:
      - backend-network

  db:
    image: mysql:8.0
    environment:
      MYSQL_DATABASE: ${DB_NAME}
      # MYSQL_USER: ${DB_USER}
      # MYSQL_PASSWORD: ${DB_PASSWORD}
      MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
    volumes:
      - db_data:/var/lib/mysql
    networks:
      - backend-network

  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    ports:
      - "8080:80"
    environment:
      PMA_HOST: db
      MYSQL_ROOT_PASSWORD: 
    depends_on:
      - db
    networks:
      - backend-network

networks:
  backend-network:
    driver: bridge

volumes:
  db_data: