Browse Source

Tweaks to when we do docker job.

xmkb
Pete Johanson 5 years ago
parent
commit
c5e4eea3fd
  1. 9
      .gitlab-ci.yml

9
.gitlab-ci.yml

@ -22,11 +22,16 @@ build:dockerimage:
image: docker:stable image: docker:stable
rules:
- if: '$CI_COMMIT_REF_SLUG =~ /^docker/'
when: always
before_script: before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script: script:
- docker pull $CI_BUILD_IMAGE:latest || true - docker pull $CI_BUILD_IMAGE:latest || true
- docker build --cache-from $CI_BUILD_IMAGE:latest -t $CI_BUILD_IMAGE:latest . - docker build --cache-from $CI_BUILD_IMAGE:latest -t $CI_BUILD_IMAGE:$CI_COMMIT_SHORT_SHA .
- docker push $CI_BUILD_IMAGE:latest - docker push $CI_BUILD_IMAGE:$CI_COMMIT_SHORT_SHA
- docker tag $CI_BUILD_IMAGE:$CI_COMMIT_SHORT_SHA $CI_BUILD_IMAGE:latest && git push $CI_BUILD_IMAGE:latest
- if [ -n "$CI_COMMIT_TAG" ]; then docker tag $CI_BUILD_IMAGE:$CI_COMMIT_SHORT_SHA $CI_BUILD_IMAGE:$CI_COMMIT_TAG && docker push $CI_BUILD_IMAGE:$CI_COMMIT_TAG; fi

Loading…
Cancel
Save