Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

436
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda