-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use docker compose to run cypress.
- Loading branch information
Showing
6 changed files
with
91 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
version: '3' | ||
|
||
services: | ||
dev: | ||
image: cypress/browsers:latest | ||
ports: | ||
# Share debugging ports | ||
- 5566:5566 | ||
- 5567:5567 | ||
environment: | ||
# Use Hist file from shared volume | ||
HISTFILE: /root/hist/.bash_history | ||
# Setup inspect to use the more permissive address when debugging so | ||
# that we can connect to it from ouside the docker container | ||
CYPRESS_DOCKER_DEV_INSPECT_OVERRIDE: '0.0.0.0:5566' | ||
# This disables CI mode which causes cypress to build differently | ||
CI: '' | ||
command: /bin/bash | ||
working_dir: /opt/cypress | ||
volumes: | ||
# Copy Cypress source to docker container | ||
- .:/opt/cypress | ||
- bash-history:/root/hist | ||
watch: | ||
image: cypress/browsers:latest | ||
environment: | ||
# This disables CI mode which causes cypress to build differently | ||
CI: '' | ||
command: yarn watch | ||
working_dir: /opt/cypress | ||
volumes: | ||
# Copy Cypress source to docker container | ||
- .:/opt/cypress | ||
ci: | ||
# This should mirror the image used in workflows.yml | ||
image: cypress/browsers:node16.16.0-chrome106-ff99-edge | ||
ports: | ||
- 5566:5566 | ||
- 5567:5567 | ||
command: /bin/bash | ||
environment: | ||
HISTFILE: /root/hist/.bash_history | ||
CYPRESS_DOCKER_DEV_INSPECT_OVERRIDE: '0.0.0.0:5566' | ||
working_dir: /opt/cypress | ||
volumes: | ||
- .:/opt/cypress | ||
- bash-history:/root/hist | ||
|
||
# persist terminal history between runs in a virtual volume | ||
volumes: | ||
bash-history: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,14 @@ | ||
#!/bin/bash | ||
SERVICE=${1:-ci} | ||
|
||
set e+x | ||
|
||
echo "This script should be run from cypress's root" | ||
|
||
name=cypress/browsers:node16.16.0-chrome106-ff99-edge | ||
echo "Pulling CI container $name" | ||
|
||
docker pull $name | ||
docker compose build ${SERVICE} | ||
|
||
echo "Starting Docker image with cypress volume attached" | ||
echo "Starting Docker compose service, $SERVICE, with cypress volume attached" | ||
echo "You should be able to edit files locally" | ||
echo "but execute the code in the container" | ||
|
||
docker run -v $PWD:/home/person/cypress \ | ||
-w /home/person/cypress${WORKING_DIR:-} \ | ||
-it $name \ | ||
/bin/bash | ||
docker compose run --service-ports ${SERVICE} |