variables: GITLAB_IMAGE: registry.gitlab.com/oceanboltpub/tile38 stages: - build - push .build_images: &build_images before_script: - echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token registry.gitlab.com --password-stdin - docker login -u _json_key --password-stdin https://eu.gcr.io < $GITLAB_DEPLOY_BOT_KEY image: docker:19.03.0 services: - docker:19.03.0-dind variables: #DOCKER_HOST: tcp://localhost:2375 DOCKER_TLS_DIR: "/certs" DOCKER_DRIVER: overlay2 stage: build only: - master - development - merge_requests tags: - docker script: - docker pull $GITLAB_IMAGE:$EDITION || true - > docker build --build-arg VCS_REF=$CI_COMMIT_SHA --build-arg VCS_URL=$CI_PROJECT_URL --tag $GITLAB_IMAGE:$CI_COMMIT_SHA . - docker push $GITLAB_IMAGE .push_master: &push_master before_script: - echo $CI_JOB_TOKEN | docker login -u gitlab-ci-token registry.gitlab.com --password-stdin - docker login -u _json_key --password-stdin https://eu.gcr.io < $GITLAB_DEPLOY_BOT_KEY image: docker:19.03.0 services: - docker:19.03.0-dind stage: push only: - master variables: # Again, we do not need the source code here. Just playing with Docker. GIT_STRATEGY: none #DOCKER_HOST: tcp://localhost:2375 DOCKER_DRIVER: overlay2 # Create the certificates inside this directory for both the server # and client. The certificates used by the client will be created in # /certs/client so we only need to share this directory with the # volume mount in `config.toml`. DOCKER_TLS_CERTDIR: "/certs" script: - docker pull $GITLAB_IMAGE:$CI_COMMIT_SHA - docker tag $GITLAB_IMAGE:$CI_COMMIT_SHA $GITLAB_IMAGE:latest - docker push $GITLAB_IMAGE:latest # Here, the goal is to tag the "master" branch as "latest"