From e2e63ae4970df9fb30c5a606d6d58bad3a505884 Mon Sep 17 00:00:00 2001 From: William Miceli <1-WilliamMiceli@git.williammiceli.systems> Date: Thu, 28 Mar 2019 16:17:20 -0400 Subject: [PATCH] Testing new CI format --- .gitlab-ci.yml | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3b188d5..37138ca 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,41 +4,38 @@ services: - docker:dind stages: - - build + - Build Image + - Push to Docker Hub + - Cleanup Runner variables: - # When using dind service we need to instruct docker, to talk with the - # daemon started inside of the service. The daemon is available with - # a network connection instead of the default /var/run/docker.sock socket. - # - # The 'docker' hostname is the alias of the service container as described at - # https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#accessing-the-services - # - # Note that if you're using Kubernetes executor, the variable should be set to - # tcp://localhost:2375 because of how Kubernetes executor connects services - # to the job container DOCKER_HOST: tcp://docker:2375/ - # When using dind, it's wise to use the overlayfs driver for - # improved performance. DOCKER_DRIVER: overlay2 before_script: - docker info - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY -build-master: - stage: build +build: + stage: Build Image + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" . + +push-master: + stage: Push to Docker Hub script: - - docker build --pull -t $CI_REGISTRY_IMAGE . - docker push "$CI_REGISTRY_IMAGE" only: - master -build: - stage: build +push-other: + stage: Push to Docker Hub script: - - docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" . - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" except: - master +cleanup: + stage: Cleanup Runner + script: + - docker image prune --all --force \ No newline at end of file