CI: Push master images to the Docker hub.

This commit is contained in:
Grégoire Henry 2017-01-26 09:58:21 +01:00
parent 42f118f486
commit 07641eb594
4 changed files with 19 additions and 7 deletions

View File

@ -1,4 +1,7 @@
.git .git
.gitignore
.gitlab-ci.yml
tezos-node tezos-node
tezos-protocol-compiler tezos-protocol-compiler

View File

@ -3,6 +3,9 @@ variables:
image_id: ${CI_BUILD_REF_NAME} image_id: ${CI_BUILD_REF_NAME}
build_image_name: ${image_name}_build_deps build_image_name: ${image_name}_build_deps
build_image_id: ${CI_BUILD_REF} build_image_id: ${CI_BUILD_REF}
private_registry: registry.ocamlpro.com:8443
private_image_id: $private_registry/${CI_PROJECT_PATH}
public_image_id: docker.io/tezosledger/tezos:latest
image: ${build_image_name}:${build_image_id} image: ${build_image_name}:${build_image_id}
@ -141,14 +144,21 @@ publish:docker:
stage: publish stage: publish
image: ocp:docker image: ocp:docker
tags: tags:
- docker_builder - public_docker_builder
script: script:
- ./scripts/create_docker_image.sh ${image_name} ${build_image_id} - ./scripts/create_docker_image.sh ${image_name} ${build_image_id}
- docker tag ${image_name}:${build_image_id} - docker tag ${image_name}:${build_image_id}
"$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" "$private_image_id:$CI_BUILD_REF_NAME"
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $private_registry
- docker push "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" - docker push "$private_image_id:$CI_BUILD_REF_NAME"
- docker rmi "$CI_REGISTRY_IMAGE:$CI_BUILD_REF_NAME" - docker rmi "$private_image_id:$CI_BUILD_REF_NAME"
- if [ "$CI_PROJECT_PATH" = "tezos/tezos" -a "$CI_BUILD_REF_NAME" = "master" ]; then
mkdir ~/.docker ;
echo "$CI_DOCKER_AUTH" > ~/.docker/config.json ;
docker tag ${image_name}:${build_image_id} ${public_image_id} ;
docker push ${public_image_id} ;
docker rmi ${public_image_id} ;
fi
publish:github: publish:github:
image: ocaml/opam image: ocaml/opam
@ -188,3 +198,4 @@ cleanup:
${build_image_name}:${CI_PROJECT_NAMESPACE}_${CI_BUILD_REF_NAME} ${build_image_name}:${CI_PROJECT_NAMESPACE}_${CI_BUILD_REF_NAME}
- docker rmi ${build_image_name}:${build_image_id} - docker rmi ${build_image_name}:${build_image_id}
when: always when: always
allow_failure: true

View File

@ -1,7 +1,6 @@
#! /bin/sh #! /bin/sh
set -e set -e
set -x
script_dir="$(dirname "$(readlink -f "$0")")" script_dir="$(dirname "$(readlink -f "$0")")"
src_dir="$(dirname "$script_dir")" src_dir="$(dirname "$script_dir")"

View File

@ -1,7 +1,6 @@
#! /bin/sh #! /bin/sh
set -e set -e
set -x
script_dir="$(dirname "$(readlink -f "$0")")" script_dir="$(dirname "$(readlink -f "$0")")"
src_dir="$(dirname "$script_dir")" src_dir="$(dirname "$script_dir")"