version: '3'

services:
  qb.test:
      image: linuxserver/qbittorrent
      container_name: qbittorrent
      environment:
        - PUID=1000
        - PGID=1000
        - UMASK_SET=022
        - WEBUI_PORT=8080
      ports:
        - 8080:8080
      volumes:
        - ./qbittorrent:/config
        - ./downloads:/downloads
      restart: unless-stopped
  app:
    container_name: qb-web
    depends_on: 
        - qb.test
    # Using a Dockerfile is optional, but included for completeness.
    build: 
      context: .
      dockerfile: Dockerfile
      # [Optional] You can use build args to set options. e.g. 'VARIANT' below affects the image in the Dockerfile
      args: 
        VARIANT: 16-buster

    volumes:
      # This is where VS Code should expect to find your project's source code and the value of "workspaceFolder" in .devcontainer/devcontainer.json
      - ..:/workspace:cached

      # Uncomment the next line to use Docker from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker-compose for details.
      # - /var/run/docker.sock:/var/run/docker.sock 

    # Overrides default command so things don't shut down after the process ends.
    command: /bin/sh -c "while sleep 1000; do :; done"  

    # Runs app on the same network as the service container, allows "forwardPorts" in devcontainer.json function.
    network_mode: service:qb.test