services:
  db:
    image: mysql:8
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: goonie
    volumes:
      - db_data:/var/lib/mysql
    ports:
      - "3306:3306"
    networks:
      - app_net

  app:
    build: .
    container_name: goonie
    depends_on:
      - db
    environment:
      DATABASE_URL: mysql://root:root@db:3306/goonie
      NODE_ENV: production
    ports:
      - "3000:3000"
    command: ["node", "server.js"]
    networks:
      - app_net

volumes:
  db_data:
  
networks:
  app_net:
    driver: bridge