version: '2.4'

services:
    app:
        build: './nginx'
        image: 'nginx-certbot:stable-alpine'
        restart: 'always'

        env_file:
            - '.env'
        networks:
            - 'nginx'
        ports:
            - '$HTTP_PORT:$HTTP_PORT'
            - '$HTTPS_PORT:$HTTPS_PORT'
        volumes:
            - './nginx.conf:/etc/nginx/nginx.conf'
            - './sites-enabled:/etc/nginx/sites-enabled'
            - './templates:/etc/nginx/templates'
            - 'certs:/etc/letsencrypt'

networks:
    nginx:
        external: true

volumes:
    certs: