version: "3.7"
services:
  app:
    build:
      context: ./
      dockerfile: Dockerfile
    image: facturacion-electronica-api
    container_name: facturacion-electronica-api
    restart: unless-stopped
    working_dir: /var/www/
    environment:
      - DB_HOST=facturacion-electronica-api-database
      - DB_PORT=3306
      - DB_DATABASE=certificador
      - DB_USERNAME=root
      - DB_PASSWORD=secret
    depends_on:
      - "database"
    volumes:
      - ./:/var/www
    networks:
      - facturacion-electronica-api-network
  nginx:
    image: nginx:alpine
    container_name: facturacion-electronica-api-nginx
    restart: unless-stopped
    ports:
      - 8000:80
    volumes:
      - ./:/var/www
      - ./docker-compose/nginx:/etc/nginx/conf.d/
      - ./storage/logs/:/var/log/nginx
    networks:
      - facturacion-electronica-api-network
  database:
    container_name: facturacion-electronica-api-database
    image: mariadb:latest
    volumes:
      - dbdata:/var/lib/mysql
    environment:
      - MYSQL_DATABASE="certificador"
      - MYSQL_ROOT_PASSWORD="secret"
    ports:
      - 3307:3306
    networks:
      - facturacion-electronica-api-network
volumes:
  dbdata:
networks:
  facturacion-electronica-api-network:
    driver: bridge
