version: "3"
services:
  upapet-app:
    container_name: app.upapet
    build:
      context: .docker/
    volumes:
      - ./:/var/www/
    networks:
      - upapet
      - proxy-net
    depends_on:
      - upapet-db

  upapet-nginx:
    container_name: nginx.upapet
    image: nginx:alpine
    restart: unless-stopped
    ports:
      - 8081:80
      - 4431:443
    volumes:
      - ./:/var/www/
      - .docker/confs/nginx/:/etc/nginx/conf.d/
      - /home/ulisses/nginx/certs:/etc/nginx/certs:ro
    networks:
      - upapet
      - proxy-net
    depends_on:
      - upapet-app

  upapet-db:
    container_name: db.upapet
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: upapet
      MYSQL_USER: upapet_user
      MYSQL_PASSWORD: secret
    ports:
      - "3306:3306"
    volumes:
      - mysql_data:/var/lib/mysql
    networks:
      - upapet
      - proxy-net
networks:
  upapet:
    driver: bridge
  proxy-net:
    external: true  

volumes:
  mysql_data:

