You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

.gitlab-ci.yml 584B

1234567891011121314151617181920
  1. image: docker:stable
  2. services:
  3. - docker:dind
  4. variables:
  5. CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH
  6. DOCKER_HOST: tcp://docker:2375
  7. DOCKER_DRIVER: overlay2
  8. before_script:
  9. - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com
  10. build:
  11. stage: build
  12. script:
  13. - docker pull $CONTAINER_IMAGE:$CI_COMMIT_REF_NAME || true
  14. - docker build --cache-from $CONTAINER_IMAGE:latest --tag $CONTAINER_IMAGE:$CI_COMMIT_REF_NAME .
  15. - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  16. - docker push $CONTAINER_IMAGE:$CI_COMMIT_REF_NAME