From 325557a49989e0a05a03e3bdc1c80d48453cd430 Mon Sep 17 00:00:00 2001 From: Mike McCready <66998419+MikeMcC399@users.noreply.github.com> Date: Wed, 29 May 2024 17:58:42 +0200 Subject: [PATCH] docs: fix README Examples issues --- README.md | 11 +---------- included/README.md | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 2280a6ccbd..c1782e72bc 100644 --- a/README.md +++ b/README.md @@ -54,16 +54,7 @@ Don't see the exact combination of Cypress, Node.js and browser versions you nee ## Examples -These images have all dependencies necessary to install and run Cypress. Just install your npm dependencies (including Cypress) and run the tests. We utilize many of these docker images in our own projects, with different CI providers. - -[Check out our docs for examples.](https://on.cypress.io/docker) - -If you want to use the `cypress/included` image, read [Run Cypress with a single Docker command](https://www.cypress.io/blog/2019/05/02/run-cypress-with-a-single-docker-command/) - -- [examples/included-as-non-root](examples/included-as-non-root) shows how to build a new Docker image on top of `cypress/included` image and run the tests as non-root user `node`. -- [examples/included-as-non-root-alternative](examples/included-as-non-root-alternative) shows another approach to allow built-in non-root user `node` to run tests using `cypress/included` image. -- [examples/included-as-non-root-mapped](examples/included-as-non-root-mapped) shows how to build a Docker image on top of `cypress/included` that runs with a non-root user that matches the id of the user on the host machine. This way, the permissions on any files created during the test run match the user's permissions on the host machine. -- [examples/included-with-plugins](examples/included-with-plugins) shows how to use locally installed [Cypress plugins](https://on.cypress.io/plugins) while running `cypress/included` image. +Check out the [README](./included/README.md) document in the [included](./included) directory for examples of how to use `cypress/included` images. (As described above, these images include all operating system dependencies, Cypress, and some browsers installed globally.) ## Common problems diff --git a/included/README.md b/included/README.md index 92e2a188ab..8f8bd09b7d 100644 --- a/included/README.md +++ b/included/README.md @@ -138,11 +138,7 @@ DevTools listening on ws://127.0.0.1:45315/devtools/browser/0c510bb9-b365-49e7-8 ## Default user -By default, the included images run as `root` user. You can switch the user to the second user in the image `node` or custom-mapped user, see [examples section](https://github.com/cypress-io/cypress-docker-images#examples). Starting with `cypress/included:3.8.1` we set permissions on the globally installed Cypress and set binary cache variable to allow other users read and execute access. Thus you will be able to run Cypress as non-root user by using `-u node` - -```shell -$ docker run -it -v $PWD/src:/test -w /test -u node cypress/included:13.10.0 -``` +By default, `cypress/included` images run as `root` user. You can switch to the non-root user `node` in the image or to a custom-mapped user, see the [Alternate users](#alternate-users) section below. ## GitHub Action @@ -169,3 +165,17 @@ If you want to simulate slow container, run the Docker container with `--cpus` p ```shell docker run -it -v $PWD:/e2e -w /e2e --cpus=0.02 -e DEBUG=cypress:launcher --entrypoint=cypress cypress/included:13.10.0 info ``` + +## Alternate users + +The following examples are built on `cypress/included:3.8.0` and have not yet been updated to demonstrate current Cypress versions: + +- [examples/included-as-non-root](../examples/included-as-non-root) shows how to build a new Docker image on top of `cypress/included` image and run the tests as non-root user `node`. +- [examples/included-as-non-root-alternative](../examples/included-as-non-root-alternative) shows another approach to allow built-in non-root user `node` to run tests using `cypress/included` image. +- [examples/included-as-non-root-mapped](../examples/included-as-non-root-mapped) shows how to build a Docker image on top of `cypress/included` that runs with a non-root user that matches the id of the user on the host machine. This way, the permissions on any files created during the test run match the user's permissions on the host machine. + +## Using plugins + +The following example is built on `cypress/included:3.8.0` and has not yet been updated to demonstrate current Cypress versions: + +- [examples/included-with-plugins](../examples/included-with-plugins) shows how to use locally installed [Cypress plugins](https://on.cypress.io/plugins) while running `cypress/included` image.