version: "3"
name: rpg-ascorrea-com
services:
    webserver:
        container_name: web
        build:
            context: .
        hostname: webserver
        volumes:
          - ./apps/podcast:/var/www/podcast
          - ./apps/html:/var/www/html
          - ./apps/rolladvantage/:/var/www/rolladvantage
          - dir2cast:/var/www/dir2cast
          - type: bind
            source: ./apps/certbot/www
            target: /var/www/certbot
            read_only: true
          - type: bind
            source: ./apps/certbot/conf
            target: /etc/nginx/ssl
            read_only: true
          - ./apps/rolladvantage/rolladvantage.nginx.conf:/etc/nginx/conf.d/apps-enabled/rolladvantage.conf
          
          - ./apps/podcast/podcast.nginx.conf:/etc/nginx/conf.d/apps-enabled/podcast.conf
          - ./apps/filebrowser/filebrowser.nginx.conf:/etc/nginx/conf.d/apps-enabled/filebrowser.conf
          - ./apps/foundry/foundry.nginx.conf:/etc/nginx/conf.d/apps-enabled/foundry.conf
          - ./apps/nginx/conf.d/swrpg.ascorrea.com.conf:/etc/nginx/conf.d/swrpg.ascorrea.com.conf
          - ./apps/vouch/vouch.nginx.conf:/etc/nginx/conf.d/apps-enabled/vouch.conf
          - ./apps/metube/metube.nginx.conf:/etc/nginx/conf.d/apps-enabled/metube.conf
          - ./apps/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
        environment:
          TZ: "America/Chicago"
        ports:
          - "80:80"
          - "443:443"
        networks:
          - internal
    certbot:
      container_name: certbot
      image: certbot/certbot:latest
      volumes:
        - type: bind
          source: ./apps/certbot/www
          target: /var/www/certbot
        - type: bind
          source: ./apps/certbot/conf
          target: /etc/letsencrypt
    php:
        container_name: php
        image: php:7.0-fpm  
        hostname: php
        volumes:        
          - type: bind
            source: ./apps/podcast
            target: /var/www/podcast
          - dir2cast:/var/www/dir2cast
        environment:
          TZ: "America/Chicago"
          UID: 33
          GID: 33
        networks:
          - internal       
    filebrowser:
        container_name: filebrowser
        build: 
            context: ./apps/filebrowser
        hostname: filebrowser
        volumes:
          - filebrowser:/srv/filebrowser
          - foundry:/srv/foundry
          - metube:/srv/metube
#           - ./apps/filebrowser/database.db:/database.db
          - ./apps/filebrowser/filebrowser.json:/.filebrowser.json
          - ./apps/filebrowser/docker-entrypoint.sh:/docker-entrypoint.sh
          - ./apps/podcast:/srv/podcast
        environment:
          TZ: "America/Chicago"
          UID: 33
          GID: 33
          AUTH_METHOD: proxy
          AUTH_HEADER: X-Vouch-User
        networks:
          - internal
    foundry:
        container_name: foundry
        build: 
            context: ./apps/foundry
        hostname: foundry
        init: true
        volumes:
          - foundry:/data
          - metube:/srv/metube
          - ./apps/foundry/container_cache:/data/container_cache
        environment:
          TZ: "America/Chicago"
          FOUNDRY_UID: 33
          FOUNDRY_GID: 33
          FOUNDRY_ROUTE_PREFIX: "foundry"
        secrets:
          - source: config_json_foundry
            target: config.json
        networks:
          - internal
    vouch:
        container_name: vouch
        image: quay.io/vouch/vouch-proxy
        environment:
          TZ: "America/Chicago"
          UID: 33
          GID: 33
        volumes:
            - ./apps/vouch/config.yml:/config/config.yml
        networks:
          - internal
    metube:
        container_name: metube
        hostname: metube
        image: ghcr.io/alexta69/metube
#         restart: unless-stopped
        environment:
            URL_PREFIX: "/metube"
        volumes:
            - metube:/downloads
        networks:
          - internal
networks:
  internal:
    driver: bridge


secrets:
  config_json_foundry:
    file: apps/foundry/foundry_secrets.json
    
volumes:
  filebrowser:
  foundry:
  podcast:
  metube:
  dir2cast: