version: '3'
services:
  web:
    build: .
    expose:
      - "8000"
    # 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;\"'"

  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;'"

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


# version: '3'

# services:
#   web:
#     build: .
#     ports:
#       - "8000:8000"

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