services:
  pantoiaperiodicadb:
    image: mysql:5.7
    container_name: mysql-db-pantoiaperiodica
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${DB_NAME}
      MYSQL_USER: ${DB_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    volumes:
      - pantoiaperiodica-db-data:/var/lib/mysql
      - ./db-dump:/docker-entrypoint-initdb.d
    networks:
      - pantoiaperiodica-app-network

  pantoiaperiodica:
    build: .
    container_name: web-pantoiaperiodica
    restart: always
    depends_on:
      - pantoiaperiodicadb
    environment:
      DB_HOST: ${DB_HOST}
      DB_USER: ${DB_USER}
      DB_PASS: ${DB_PASS}
      DB_NAME: ${DB_NAME}
    networks:
      - pantoiaperiodica-app-network
      - caddynet

networks:
  pantoiaperiodica-app-network:
    driver: bridge
  caddynet:
    external: true

volumes:
  pantoiaperiodica-db-data:
    external: true
