Commit cf30a6f2 authored by Jan Kiene's avatar Jan Kiene
Browse files

add docker commands to image-building job template

parent 8fd97d08
Loading
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -18,12 +18,19 @@ stages:
  - compare

# template for job that builds docker images and pushes them to the container registry (once enabled)
# name of child job determines name of image and name of dockerfile in ci/
# NOTE: this will only work once the container registry is activated in the project
.build-docker-image:
  stage: maintenance
  tags:
    - shell
  script:
    - echo "test"
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
    - IMAGE_LATEST=CI_REGISTRY_IMAGE/$CI_BUILD_NAME:latest
    - IMAGE_TAG=CI_REGISTRY_IMAGE/$CI_BUILD_NAME:$CI_COMMIT_SHORT_SHA
    - echo "Build $IMAGE_TAG"
    - docker build -t $IMAGE_TAG -t $IMAGE_LATEST -f ci/$CI_BUILD_NAME.dockerfile
    - docker push $IMAGE_LATEST
  rules:
    - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
      when: manual