Comments (8)
In case this helps someone else...
I'm using the jenkins declarative pipeline syntax in a Jenkinsfile
, jenkins runs containers by default as the jenkins user on the host but I've found (unexpectedly) that you can override that (feel free not to use root ;) ) with:
stage('Cypress') {
agent {
dockerfile {
dir 'test/cypress'
args '-u 0:0'
}
}
steps {
sh 'PROJECT=$(pwd) && cd /opt/cypress && $(npm bin)/cypress run --project ${PROJECT}/test/cypress'
}
}
With test/cypress/Dockerfile
:
FROM cypress/base:8
WORKDIR /opt/cypress
RUN echo '{}' > package.json && \
npm install cypress
Thanks @Flambe and @bahmutov for documenting!
from cypress-docker-images.
We have recently made cypress/base:8
the default image in #34 (which upgrades Node to 8), so you should switch to building from cypress/base:6
image. Then it works
FROM cypress/base:6
RUN npm install -g cypress
RUN cypress version
RUN cypress verify
$ docker build .
Sending build context to Docker daemon 36.86kB
Step 1/4 : FROM cypress/base:6
---> 79e6b8ee7ca4
Step 2/4 : RUN npm install -g cypress
---> Using cache
---> 47f787811594
Step 3/4 : RUN cypress version
---> Running in 59a161dd1c0b
Cypress package version: 2.1.0
Cypress binary version: 2.1.0
Removing intermediate container 59a161dd1c0b
---> 35653303a9db
Step 4/4 : RUN cypress verify
---> Running in 204d86b7f280
It looks like this is your first time using Cypress: 2.1.0
[14:34:05] Verifying Cypress can run /usr/local/lib/node_modules/cypress/dist/Cypress [started]
[14:34:06] Verified Cypress! /usr/local/lib/node_modules/cypress/dist/Cypress [title changed]
[14:34:06] Verified Cypress! /usr/local/lib/node_modules/cypress/dist/Cypress [completed]
Removing intermediate container 204d86b7f280
---> 944e171ba654
Successfully built 944e171ba654
from cypress-docker-images.
That's worked, thank you!
Do you happen to know why node 8 breaks it?
from cypress-docker-images.
the combination of the default user and npm install permissions I think, but the use case for installing Cypress globally is pretty slim right now, so we recommend installing it locally just like a regular dependency. Plus once we do a better job caching the downloaded binary (cypress-io/cypress#1300) then it would not be very painful even locally.
from cypress-docker-images.
Ah right.
The biggest problem with caching locally (for us) is that our current CI setup runs in disposable dockers each time. This'd mean that we're still installing from scratch each time.
If you do end up pre-caching in the base images, that'd be good (for us).
from cypress-docker-images.
yeah, it is a problem. So on CircleCI and on Travis you can cache installed dependencies, even for Docker builds, other CIs should allow the same. For example cypress-example-recipes shows how to do this
- https://github.com/cypress-io/cypress-example-recipes/blob/master/circle.yml
- https://github.com/cypress-io/cypress-example-recipes/blob/master/.travis.yml
And if you are hardcore Docker user, you could make a Docker images using your dependencies as a first step of the build using something like this https://github.com/bahmutov/double-docker
from cypress-docker-images.
We're using jenkins, but yeah, there should be something out there that I can find.
Thank you for all the info and help! I'll keep looking into it.
from cypress-docker-images.
Got exactly the same problem (cypress + docker + jenkins)
from cypress-docker-images.
Related Issues (20)
- A tag is needed to set the Node version HOT 1
- Node 20.13.0 gpg: Can't check signature: No public key HOT 3
- Manifest not found for cypress/included:13.9.0 image HOT 4
- chrome - only node 20+ image HOT 1
- cypress/included:13.9.0 does not include curl HOT 6
- Support node >= 18.19 for --import support on nodejs HOT 2
- Latest Docker image not compatible with ESM, failing with "configFile is invalid ... Unexpected identifier 'assert'" HOT 8
- Outdated Node.js 18.x images HOT 3
- Request for feature branch Cypress and Node.js latest HOT 3
- Outdated legacy examples/included-as-non-root HOT 1
- Obsolete examples/included-as-non-root-alternative HOT 1
- Review: examples/included-as-non-root-mapped
- Review: examples/included-with-plugins
- "Push Factory Image" failure checking `cypress/factory:4.0.1` HOT 9
- Migrate to current Docker version HOT 1
- cypress/browsers image suddenly has a /root/.ssh directory HOT 3
- Short tag cypress/included:13.11.0 points to Node.js 18.20.3 versions HOT 1
- The automation client disconnected. Cannot continue running tests. Cypress 12.14.0 Firefox 126 (headless) Node 18.8.0 HOT 9
- Add examples: cypress/base, cypress/browsers and GitHub Actions HOT 5
- Feature Branch Request HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-docker-images.