Hi,
I’m trying to build and then test a docker image. The build step is working fine and the image is pushed to the registry. However, when I’m trying to use it in the subsequent steps the commands aren’t run within the container specified.
Here is my gitlab-ci.yml:
stages:
- build
- analytics
variables:
TEST_IMAGE_NAME: ‘registry.server.de/testimage’build_testing_container:
stage: buildimage: docker:stable
services:
- dind
script:
- docker build --target=testing -t $TEST_IMAGE_NAME .
- docker push $TEST_IMAGE_NAMEmess_detection:
stage: analytics
image: $TEST_IMAGE_NAMEscript:
- vendor/bin/phpmd app html tests/md.xml --reportfile mess_detection.html --suffixes phpartifacts:
name: “${CI_JOB_NAME}_${CI_COMMIT_REF_NAME}”
paths:
- mess_detection.html
expire_in: 1 week
when: alwaysexcept:
- productionallow_failure: true
For which I’m getting the following output:
Running with gitlab-runner 11.5.0 (3afdaba6)
on docker-runner1 3ecbfa81
Using Docker executor with image registry.server.de/testimage …
Pulling docker image registry.server.de/testimage …
Using docker image sha256:30fd807a3fe43ba05e7af397a830519e68a96820c80cdbeca7badaa92641310a for registry.server.de/testimage …
Running on runner-3ecbfa81-project-38-concurrent-1 via ci…
Fetching changes…
HEAD is now at 68bb62a9 Update .gitlab-ci.yml
From https://gitlab.server.de/company/ekp_docker
68bb62a9…95a80183 master → origin/master
Checking out 95a80183 as master…
Skipping Git submodules setup
$ vendor/bin/phpmd app html tests/md.xml --reportfile mess_detection.html --suffixes php
/bin/bash: line 79: vendor/bin/phpmd: No such file or directory
Uploading artifacts…
WARNING: mess_detection.html: no matching files
ERROR: No files to upload
ERROR: Job failed: exit code 1
I also noticed that the WORKDIR for that image is /build/namespace/project
instead of /app
which is specified in the image i built.
What am I missing? From my understanding, it should be possible to use a custom image and then run commands inside the container.