version: "3.4"
services:
  custom_base:
    container_name: custom_base
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DOZZLE_FILTER=name=custom_base
      - DOZZLE_BASE=/foobarbase
      - DOZZLE_NO_ANALYTICS=1
    image: amir20/dozzle_custom_cache
    build:
      context: ..
      cache_from:
        - amir20/dozzle_custom_cache:latest
  auth:
    container_name: auth
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DOZZLE_FILTER=name=auth
      - DOZZLE_USERNAME=foo
      - DOZZLE_PASSWORD=bar
      - DOZZLE_NO_ANALYTICS=1
    image: amir20/dozzle_custom_cache
    build:
      context: ..
      cache_from:
        - amir20/dozzle_custom_cache:latest
  dozzle:
    container_name: dozzle
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DOZZLE_FILTER=name=dozzle
      - DOZZLE_NO_ANALYTICS=1
    image: amir20/dozzle_cache:latest
    build:
      context: ..
      cache_from:
        - amir20/dozzle_cache:latest
  cypress:
    build:
      context: .
      cache_from:
        - amir20/dozzle_cypress_cache:latest
    image: amir20/dozzle_cypress_cache:latest
    working_dir: /e2e
    volumes:
      - ./cypress:/e2e/cypress
      - ./cypress.config.ts:/e2e/cypress.config.ts
    environment:
      - CYPRESS_DOZZLE_DEFAULT=http://dozzle:8080/
      - CYPRESS_DOZZLE_AUTH=http://auth:8080/
      - CYPRESS_DOZZLE_CUSTOM=http://custom_base:8080/foobarbase
      - CYPRESS_RECORD_KEY=155c3cf8-b2dd-4f5e-9fb3-7635f5b79d4d
      - COMMIT_INFO_BRANCH=${GITHUB_REF_NAME}
      - COMMIT_INFO_AUTHOR=${GITHUB_ACTOR}
      - COMMIT_INFO_SHA=${GITHUB_SHA}
      - COMMIT_INFO_MESSAGE=${GIT_LOG_MESSAGE}
      - COMMIT_INFO_REMOTE=https://github.com/amir20/dozzle
    command: cypress run --record
    depends_on:
      - dozzle
      - custom_base
