Anapher/Strive

View on GitHub
src/docker-compose.e2e.yml

Summary

Maintainability
Test Coverage
version: "3.4"

services:
  traefik:
    image: "traefik:v2.4"
    container_name: "traefik"
    command:
      - "--entrypoints.web.http.redirections.entryPoint.to=websecure"
      - "--entrypoints.web.http.redirections.entryPoint.scheme=https"
      - "--entrypoints.web.http.redirections.entrypoint.permanent=true"

    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    volumes:
      - "//var/run/docker.sock:/var/run/docker.sock:ro"
      - "./traefik.yml:/traefik.yml:ro"

  e2e:
    image: ${DOCKER_REGISTRY-}e2e
    build: ./Tests/e2e
    depends_on:
      - webspa
    command: ${CYPRESS_COMMAND-}
    # note: inside e2e container, the network allows accessing
    # "web" host under name "web"
    # so "curl http://web" would return whatever the webserver
    # in the "web" container is cooking
    # see https://docs.docker.com/compose/networking/
    environment:
      - CYPRESS_baseUrl=https://localhost
      - CYPRESS_RECORD_KEY=${CYPRESS_RECORD_KEY-}
      - COMMIT_INFO_BRANCH=${COMMIT_INFO_BRANCH}
      - COMMIT_INFO_MESSAGE=${COMMIT_INFO_MESSAGE}
      - COMMIT_INFO_EMAIL=${COMMIT_INFO_EMAIL}
      - COMMIT_INFO_AUTHOR=${COMMIT_INFO_AUTHOR}
      - COMMIT_INFO_SHA=${COMMIT_INFO_SHA}
      - COMMIT_INFO_REMOTE=${COMMIT_INFO_REMOTE}

    # mount the host directory e2e/cypress and the file e2e/cypress.json as
    # volumes within the container
    # this means that:
    #  1. anything that Cypress writes to these folders (e.g., screenshots,
    #     videos) appears also on the Docker host's filesystem
    #  2. any change that the developer applies to Cypress files on the host
    #     machine immediately takes effect within the e2e container (no docker
    #     rebuild required).
    volumes:
      - ./Tests/e2e/cypress:/cypress
      - ./Tests/e2e/cypress.json:/cypress.json

    network_mode: host