Build Cypress docker image for simple CI
See original GitHub issueMost CI allow using custom Docker image as base. It would be really cool to have official public Cypress docker image. We have built one, here is our docker file
FROM node:6
RUN apt-get update
RUN apt-get install libgtk2.0-0 libnotify4 libgconf2-4 libnss3 xvfb --yes
RUN npm set progress=false
RUN npm i -g cypress-cli
ARG CYPRESS_VERSION
ENV CYPRESS_VERSION ${CYPRESS_VERSION:-0.16.2}
RUN echo Cypress version to install $CYPRESS_VERSION
RUN cypress install
RUN cypress verify
One could use specific cypress-cli
version inside if needed.
To build and tag the image, we use this script
set e+x
# build image with everything needed to run Cypress
VERSION=0.16.2
LOCAL_NAME=front-end/cypress-ci
docker build --build-arg CYPRESS_VERSION=${VERSION} -t $LOCAL_NAME .
# tag and push the build to the registry
# https://docs.docker.com/mac/step_six/
IMAGE_ID=$(docker images -q $LOCAL_NAME)
NAME=<docker hub>/$LOCAL_NAME:$VERSION
docker tag $IMAGE_ID $NAME
docker push $NAME
We are pushing to internal Docker hub, but public is obviously the goal here. Then a Gitlab CI runner just uses that image as the base
image: <docker hub>/front-end/cypress-ci:0.16.2
# caching node_modules folder
# https://about.gitlab.com/2016/03/01/gitlab-runner-with-docker/
cache:
paths:
- node_modules/
before_script:
- cypress verify
stages:
- test
e2e_test:
stage: test
script:
- npm install
- npm test
- npm run build
- cypress ci
We have spec file bundle build step, otherwise we could just do
e2e_test:
stage: test
script:
- cypress ci
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Docker | Cypress Documentation
This repo holds various Docker images for running Cypress locally and in CI. There are Docker images: cypress/base:<Node version> has the operating system ......
Read more >Docker full circle: Continuous Integration (CI) with Cypress
Everyone is using your custom Docker image to manage dependencies and ... In this article, we'll look at building a continuous integration ......
Read more >Building custom Docker images from cypress/included [shorts]
In this article, we will explore how we can build a Docker image and push them to an image registry such as DockerHub....
Read more >Setup CI/CD Pipeline with GitHub Actions and Docker Image ...
Below is a simple test case where we searched some data and verified it. ... Below we add the container using a Cypress...
Read more >Dockerize your Cypress tests | Johnny Metz
The cypress/included docker image's entrypoint is cypress run so we need to overwrite that with cypress open . We also need to append...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I modified your Dockerfile to run in jenkins CI
I added a ubuntu user, because jenkins running under the ubuntu user jumps into the container with ids 1000:1000, which resulted in it not finding the cypress executable or not having write access for the
.config
it tries to create in/
and I think I needed the extra librarieslibasound2
libxss1
@RandallKent it would still be good to be able to run locally under Docker (we’re on a mixed Windows and Mac environment), and plug VNC into that. But exciting to hear there’s a cloud offering