cypress-io / cypress-docker-images

Docker images with Cypress dependencies and browsers
https://on.cypress.io/continuous-integration
MIT License
1.01k stars 376 forks source link

Review: examples/included-as-non-root-mapped #1086

Closed MikeMcC399 closed 1 week ago

MikeMcC399 commented 1 month ago

Situation

The examples/included-as-non-root-mapped demonstrates how to build a new Docker image on top of cypress/included using a modified user and group on macOS.

Tests

Legacy Cypress

cypress/included:5.6.0

The example builds a new Docker image based on cypress/included:5.6.0.

cd examples/included-as-non-root-mapped
./build.sh
./test.sh

Under Docker Desktop for Linux using the unmodified scripts, the new Docker image is successfully built and runs with errors recording video.

Current Cypress

After updating the Cypress project in examples/included-as-non-root-mapped/src by migrating to Cypress 13.0 and modifying the Dockerfile to build from cypress/included:13.10.0, the test project runs.

docker run -it -v $PWD/src:/test -w /test -u node cypress/included:13.10.0

When running under Docker Desktop for Linux, Cypress completes the test successfully and warns that the test directory is not writable and so it cannot save videos or screenshots. This is a related topic described under file sharing in FAQs for Docker Desktop for Linux.

Conclusion

examples/included-as-non-root-mapped does not appear to solve the issue using Docker Desktop for Linux. It may work for Docker Desktop for Mac.

This is not specifically a Cypress topic and the variations between the operating systems are difficult to cover in one Cypress Docker example. Docker keeps documentation separate for Linux, Windows and Mac file sharing because of these differences.

Docker no longer prefers using the -v syntax and now encourages using --mount instead.

Cypress users should refer to the Docker documentation for configuration solutions.

Suggestion

Label the example examples/included-as-non-root-mapped as:

Open a separate issue to update examples/included-as-non-root-mapped for a non-legacy Cypress 13.x version.

MikeMcC399 commented 2 weeks ago