diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be7115b3ea86b3487e1ab70cc0d025abdaa8cfb5..6d512c27b8af656341cc27b31be92a924381d468 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -92,23 +92,18 @@ stages: for arg in ${DOCKER_BUILD_ARGS}; do BUILD_ARGS="${BUILD_ARGS} --build-arg ${arg}"; done + - latest_image_name="${CI_REGISTRY}/${CI_PROJECT_NAME}:latest"; + - env_image_name="${CI_REGISTRY}/${CI_PROJECT_NAME}:${ENVIRONMENT}-latest"; - | docker build \ ${BUILD_ARGS} \ --pull \ - --tag "${CI_REGISTRY}/${CI_PROJECT_NAME}:${IMAGE_TAG}" \ + --tag "${env_image_name}" \ --file "${CI_PROJECT_DIR}/${DOCKERFILE}" \ "${CI_PROJECT_DIR}/."; - - docker push "${CI_REGISTRY}/${CI_PROJECT_NAME}:${IMAGE_TAG}"; - - latest_image_name="${CI_REGISTRY}/${CI_PROJECT_NAME}:${ENVIRONMENT}-latest"; - - docker tag "${CI_REGISTRY}/${CI_PROJECT_NAME}:${IMAGE_TAG}" "${latest_image_name}"; - - docker push "${latest_image_name}"; - - | - printf " - -------- - Image Name - %s:%s - -------- - " "${CI_PROJECT_NAME}" "${IMAGE_TAG}"; + - docker push "${env_image_name}"; + - docker tag "${env_image_name}" "${latest_image_name}" + - docker push "${latest_image_name}" stage: build tags: - build