version: '3.9'

services:
  varnish:
    build:
      context: varnish
      dockerfile: Dockerfile
      args:
        # sets build variables. Overridden by env, but has sane defaults
        IMAGE_HOST: ${IMAGE_HOST:-homeassistant.local}
        PROXY_HOST: ${PROXY_HOST:-app}
    ports:
      - '6081:6081'
    depends_on:
      - app

  app:
    build:
      context: .
      dockerfile: Dockerfile
    env_file: .env # sets container's environment
    environment:
      - NODE_ENV=production
      - PROTOCOL_HEADER=x-forwarded-proto
      - HOST_HEADER=x-forwarded-host
      - PORT_HEADER=x-forwarded-port
