Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obsolete examples/included-as-non-root-alternative #1085

Closed
MikeMcC399 opened this issue Jun 3, 2024 · 1 comment · Fixed by #1128
Closed

Obsolete examples/included-as-non-root-alternative #1085

MikeMcC399 opened this issue Jun 3, 2024 · 1 comment · Fixed by #1128

Comments

@MikeMcC399
Copy link
Collaborator

Situation

examples/included-as-non-root-alternative demonstrates how to build a new Docker image on top of cypress/included, giving all users read access to the /root directory and setting CYPRESS_CACHE_FOLDER=/root/.cache/Cypress.

Tests

Legacy Cypress

cypress/included:3.8.0

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

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

Under Docker Desktop for Linux, the new Docker image is successfully built, however it fails to run, outputting the error:

Error reading from: test/cypress.json

Error: EACCES: permission denied, access '/test'

Current Cypress

After updating the Cypress project in examples/included-as-non-root-alternative/src by migrating to Cypress 13.0, modifying the Dockerfile to build from cypress/included:13.10.0 and removing the check on binary_state.json, 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 however a separate topic. For file sharing in this environment see FAQs for Docker Desktop for Linux.

Conclusion

examples/included-as-non-root-alternative is redundant because all currently generated images based on factory/factory.Dockerfile already contain the steps described in the example:

RUN ls -la /root \
&& chmod 777 /root \

# point Cypress at the /root/cache no matter what user account is used
# see https://on.cypress.io/caching
CYPRESS_CACHE_FOLDER=/root/.cache/Cypress

Node.js 18.x is the lowest version still supported and all related images cypress/included:*-node-18* were generated based on the cypress/factory process. This means that they all have the fixed permissions settings.

Suggestion

Remove the examples/included-as-non-root-alternative and references to it, as it is now redundant.

@MikeMcC399 MikeMcC399 self-assigned this Jun 3, 2024
@MikeMcC399 MikeMcC399 changed the title Review: examples/included-as-non-root-alternative Obsolete examples/included-as-non-root-alternative Jun 21, 2024
@MikeMcC399
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment