Commit 7b22c2b8 authored by Shinya Maeda's avatar Shinya Maeda
Browse files

chore: Produce the latest image for feature branch and major version

This commit extends the docker image to create a floating version
which is useful to easily integrate with CI Template.
parent 573b6083
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -13,3 +13,6 @@ build:
       --build-arg "GLIBC_VERSION=$GLIBC_VERSION"
       --tag "$BUILD_IMAGE_NAME" .
    - docker push "$BUILD_IMAGE_NAME"
    - export latest_tag="${CI_REGISTRY_IMAGE}/${CI_COMMIT_REF_SLUG}:latest"
    - docker tag "$BUILD_IMAGE_NAME" $latest_tag
    - docker push $latest_tag
+3 −0
Original line number Diff line number Diff line
@@ -18,12 +18,15 @@ release-tag:
    - 'echo ${CI_JOB_TOKEN} | docker login --password-stdin -u $CI_REGISTRY_USER $CI_REGISTRY'
    - export ci_image="${CI_REGISTRY_IMAGE}"
    - export ci_image_tag=${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}
    - export ci_image_tag_major=$(echo $CI_COMMIT_TAG | sed 's/\(v[0-9]\+\)\.[0-9]\+\.[0-9]\+/\1/')
    - echo "Using tag $ci_image_tag for image"
    - docker pull "$BUILD_IMAGE_NAME"
    - docker tag "$BUILD_IMAGE_NAME" $ci_image:latest
    - docker tag "$BUILD_IMAGE_NAME" $ci_image:$ci_image_tag
    - docker tag "$BUILD_IMAGE_NAME" $ci_image:$ci_image_tag_major
    - docker push $ci_image:latest
    - docker push $ci_image:$ci_image_tag
    - docker push $ci_image:$ci_image_tag_major
  rules:
    - if: $CI_COMMIT_TAG