neiam
/cartosnap_ex
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
Update .gitlab-ci.yml file
b8f9cd9 · Gabriel Morell · 2022-06-22 05:28
Files changed
modified
.gitlab-ci.yml
+28
−24
@@ -1,26 +1,30 @@
| 1 | −docker-build: | |
| 2 | − # Use the official docker image. | |
| 3 | − image: docker:latest | |
| 1 | +image: docker:20.10.16 | |
| 2 | + | |
| 3 | +variables: | |
| 4 | + # When using dind service, you must instruct docker to talk with the | |
| 5 | + # daemon started inside of the service. The daemon is available with | |
| 6 | + # a network connection instead of the default /var/run/docker.sock socket. | |
| 7 | + # | |
| 8 | + # The 'docker' hostname is the alias of the service container as described at | |
| 9 | + # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services | |
| 10 | + # | |
| 11 | + # If you're using GitLab Runner 12.7 or earlier with the Kubernetes executor and Kubernetes 1.6 or earlier, | |
| 12 | + # the variable must be set to tcp://localhost:2375 because of how the | |
| 13 | + # Kubernetes executor connects services to the job container | |
| 14 | + # DOCKER_HOST: tcp://localhost:2375 | |
| 15 | + # | |
| 16 | + DOCKER_HOST: tcp://docker:2375 | |
| 17 | + # | |
| 18 | + # This instructs Docker not to start over TLS. | |
| 19 | + DOCKER_TLS_CERTDIR: "" | |
| 20 | + | |
| 21 | +services: | |
| 22 | + - docker:20.10.16-dind | |
| 23 | + | |
| 24 | +before_script: | |
| 25 | + - docker info | |
| 26 | + | |
| 27 | +build: | |
| 4 | 28 | stage: build |
| 5 | − services: | |
| 6 | − - docker:dind | |
| 7 | − before_script: | |
| 8 | − - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY | |
| 9 | − # Default branch leaves tag empty (= latest tag) | |
| 10 | − # All other branches are tagged with the escaped branch name (commit ref slug) | |
| 11 | 29 | script: |
| 12 | − - | | |
| 13 | − if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then | |
| 14 | − tag="" | |
| 15 | − echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'" | |
| 16 | − else | |
| 17 | − tag=":$CI_COMMIT_REF_SLUG" | |
| 18 | − echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag" | |
| 19 | − fi | |
| 20 | −- docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" . | |
| 21 | − - docker push "$CI_REGISTRY_IMAGE${tag}" | |
| 22 | − # Run this job in a branch where a Dockerfile exists | |
| 23 | − rules: | |
| 24 | − - if: $CI_COMMIT_BRANCH | |
| 25 | − exists: | |
| 26 | − - Dockerfile | |
| 30 | + - docker build -t "$CI_REGISTRY_IMAGE${tag}" . |
Parents: 0985ae3