diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c01c1406f..fdc02559e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -117,14 +117,9 @@ build:docker: stage: build_docker image: docker:latest tags: - - docker_builder + - public_docker_builder script: - - source scripts/version.sh - - sed scripts/Dockerfile.binaries.in - -e 's/$alpine_version/'"$alpine_version"'/g' > Dockerfile - - mkdir bin - - cp tezos-client tezos-node tezos-protocol-compiler bin/ - - docker build -q -t "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}" . + - ./scripts/create_docker_image.sh "${CI_REGISTRY_IMAGE}" "${CI_BUILD_REF}" . - docker login -u gitlab-ci-token -p "$CI_BUILD_TOKEN" "${CI_REGISTRY}" - docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}" "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}" @@ -135,7 +130,7 @@ publish:docker: stage: publish image: docker:latest tags: - - docker_builder + - public_docker_builder only: - master@tezos/tezos - alphanet@tezos/tezos @@ -184,6 +179,18 @@ cleanup: - docker tag "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}_build_deps" "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF_NAME}_build_deps" - docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}_build_deps" + when: always + allow_failure: true + +cleanup:public: + stage: cleanup + image: docker:latest + tags: + - public_docker_builder + only: + - master@tezos/tezos + - alphanet@tezos/tezos + script: - docker rmi "${CI_REGISTRY_IMAGE}:${CI_BUILD_REF}" when: always allow_failure: true diff --git a/scripts/create_build_deps_docker_image.sh b/scripts/create_build_deps_docker_image.sh index 34f271279..9aded630d 100755 --- a/scripts/create_build_deps_docker_image.sh +++ b/scripts/create_build_deps_docker_image.sh @@ -11,8 +11,8 @@ image_name="${1:-tezos_build_deps}" image_version="${2:-latest}" sed scripts/Dockerfile.build_deps.in \ - -e 's/$alpine_version/'"$alpine_version"'/g' \ - -e 's/$ocaml_version/'"$ocaml_version"'/g' > Dockerfile + -e 's|$alpine_version|'"$alpine_version"'|g' \ + -e 's|$ocaml_version|'"$ocaml_version"'|g' > Dockerfile docker build --pull -t "$image_name:$image_version" . diff --git a/scripts/create_docker_image.sh b/scripts/create_docker_image.sh index 8c683ebc4..3dbfc1a5c 100755 --- a/scripts/create_docker_image.sh +++ b/scripts/create_docker_image.sh @@ -25,8 +25,8 @@ cleanup () { trap cleanup EXIT INT sed scripts/Dockerfile.build_bin.in \ - -e 's/$base_name/'"$build_deps_image_name"'/g' \ - -e 's/$base_version/'"$image_version"'/g' > Dockerfile + -e 's|$base_name|'"$build_deps_image_name"'|g' \ + -e 's|$base_version|'"$image_version"'|g' > Dockerfile echo Building tezos... tmp_image="$(docker build -q .)" @@ -36,5 +36,5 @@ docker cp "$tmp_container":/home/opam/bin/ bin echo Building minimal docker image... sed scripts/Dockerfile.binaries.in \ - -e 's/$alpine_version/'"$alpine_version"'/g' > Dockerfile + -e 's|$alpine_version|'"$alpine_version"'|g' > Dockerfile docker build -q -t "$image_name:$image_version" .