# # version: '3'
# services:
#   web:
#     build: .
#     expose:
#       - "8000"
#     restart: unless-stopped
#     # networks:
#     #   - app-network

#   nginx:
#     image: nginx:alpine
#     ports:
#       - "80:80"
#       - "443:443"
#     volumes:
#       - ./nginx.conf:/etc/nginx/nginx.conf:ro
#       - ./certbot/conf:/etc/letsencrypt
#       - ./certbot/www:/var/www/certbot
#     depends_on:
#       - web
#     # networks:
#     #   - app-network
#     command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
#     restart: unless-stopped

#   certbot:
#     image: certbot/certbot
#     volumes:
#       - ./certbot/conf:/etc/letsencrypt
#       - ./certbot/www:/var/www/certbot
#     depends_on:
#       - nginx
#     # networks:
#     #   - app-network
#     entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew --quiet; sleep 24 & wait $${!}; done;'"
#     restart: unless-stopped

# # networks:
# #   app-network:
# #     driver: bridge


# version: '3'

version: '3.8'

services:
  fastapi:
    build: .
    ports:
      - "8000:8000"
    restart: always
    container_name: fastapi-app
    networks:
      - app-network

  # nginx:
  #   image: nginx:alpine
  #   ports:
  #     - "80:80"
  #     - "443:443"
  #   volumes:
  #     - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
  #     - /etc/letsencrypt:/etc/letsencrypt:ro
  #   depends_on:
  #     - fastapi
  #   networks:
  #     - app-network
  #   restart: always

networks:
  app-network:
    driver: bridge


  # nginx:
  #   image: nginx:alpine
  #   ports:
  #     - "80:80"
  #   volumes:
  #     - ./nginx.conf:/etc/nginx/nginx.conf:ro
  #   depends_on:
  #     - web