Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

435
Views
Docker/CI: Get access to nodeJS app, which is created in another stage

In my CI pipeline (gitlab) there is a build and an end2end-testing stage. In the build stage the files of the application will be created. Then I want to copy the generated files to the e2e_testing container to do some tests with this application.

How do I copy the generated files (/opt/project/build/core/bundle) to the image?

For e2e testing I want to use nightwatchJS - see the e2e docker image below. Maybe it is possible to use the build image within the e2e image?

What I need to do is nightwatchJS e2e testing for the generated nodeJS application


My attempt

Copy the generate files to e2e_testing container with docker cp command.

build:
  stage: build
  before_script:
    - meteor build /opt/project/build/core --directory
  script:
    - cd /opt/jaqua/build/core/bundle
    - docker build -t $CI_REGISTRY_IMAGE:latest .
  after_script:
    - docker cp /opt/project/build/core/bundle e2e_testing:/opt/project/build/core/

But this is not working, as the next stage (e2e) will create a container from the e2e:latest image. So in this container there is no bundle folder existing, so this sample script is failing.

e2e:
  image: e2e:latest
  stage: e2e
  before_script:
    - cd /opt/project/build/core/bundle && ls -la
  script:
    # - run nightwatchJS to do some e2e testing with the build bundle

e2e:latest image Dockerfile

FROM java:8-jre

## Node.js setup
RUN curl -sL https://deb.nodesource.com/setup_4.x | bash -
RUN apt-get install -y nodejs

## Nightwatch
RUN npm install -g nightwatch

A container called e2e_testing is created from this image and it is running all the time. So at the time the CI pipeline is running, the container is already existing.

But at the time, this image is created the application files are not existing, as they are generated at the build stage. So I cannot put those files in the docker image using a Dockerfile.

So how can I get access to the files generated in the build stage in the e2e stage?

Or is it possible to use the build image ($CI_REGISTRY_IMAGE:latest) within the nightwatch image (e2e)

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

What about using artifacts?

Basically move the bundle folder to the root of your repository after the build and define the bundle folder as an artifact. Then, from the e2e job, the bundle folder will be downloaded from the artifacts of the build stage and you will be able to use its contents. Here's an example of how to do this:

build:
  stage: build
  before_script:
    - meteor build /opt/project/build/core --directory
  script:
    # Copy the contents of the bundle folder to ./bundle
    - cp -r /opt/project/build/core/bundle ./bundle
    - cd /opt/jaqua/build/core/bundle
    - docker build -t $CI_REGISTRY_IMAGE:latest .
  artifacts:
    paths:
      - bundle

e2e:
  image: e2e:latest
  stage: e2e
  dependencies:
    - build
  script:
    - mkdir -p /opt/project/build/core/bundle
    - cp -r ./bundle /opt/project/build/core/bundle
    # - run nightwatchJS to do some e2e testing with the build bundle

I don't know if you still need the docker build part, so I left it in there in case you want to push that container somewhere.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!