Skip to content

Instantly share code, notes, and snippets.

@alfredlucero
Created August 3, 2020 17:32
Show Gist options
  • Save alfredlucero/e1c55d6abc8339a4acb65f74fb7103eb to your computer and use it in GitHub Desktop.
Save alfredlucero/e1c55d6abc8339a4acb65f74fb7103eb to your computer and use it in GitHub Desktop.
Cypress Tips/Tricks - Cypress Docker Compose File
version: '3.2'
services:
cypress:
image: <private_docker_image_path>:${VERSION:-latest}
# To handle OOM issues when running Cypress headless electron in Docker
shm_size: '3gb'
build:
cache_from:
- <private_docker_image_path>:latest
context: .
dockerfile: Dockerfile.cypress
# This handles other weirdness with Docker and Electron
ipc: host
environment:
# For tagging the Docker image
- VERSION
# Selected Cypress tests to run and plug into the --spec option
- CYPRESS_SPECS
# "staging" | "testing" used to run the proper "npm run cypress:run:cicd:<test_env>" command
- CYPRESS_TEST_ENV
# For Cypress parallelization purposes, we need to pass in the Buildkite build ID into the --ci-build-id option
- BUILDKITE_BUILD_ID
# Upload Cypress screenshots/videos directly to the Buildkite Artifacts tab
# in case we can't access the recordings through the Dashboard Service anymore
volumes:
- ./artifacts/video/:/opt/frontendapp/cypress/videos/
- ./artifacts/screenshots/:/opt/frontendapp/cypress/screenshots/
command: "npm run cypress:run:cicd:${CYPRESS_TEST_ENV:-staging} -- --spec '${CYPRESS_SPECS:-cypress/integration/**/*}' --parallel --ci-build-id=${BUILDKITE_BUILD_ID}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment