代码拉取完成,页面将自动刷新
CI_REGISTRY_PASSWORD
dropping CI_REGISTRY_PASS
image: docker:18-git
stages:
- build
before_script:
- export VERSION=$(cat VERSION)
- export CI_REGISTRY=${CI_REGISTRY:-hub.docker.com}
- export CI_REGISTRY_USER=${CI_REGISTRY_USER:-gitlab-ci-token}
- export CI_REGISTRY_PASSWORD=${CI_REGISTRY_PASSWORD:-${CI_JOB_TOKEN}}
- export DOCKER_IMAGE=${DOCKER_IMAGE:-${CI_REGISTRY}/${CI_PROJECT_PATH}}
- |
if [ "${DOCKER_IMAGE}" = "/" ]; then
export DOCKER_IMAGE=sameersbn/gitlab
fi
docker:build:
stage: build
only:
- master
script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
- docker build
--pull
--cache-from=${DOCKER_IMAGE}
--build-arg=VCS_REF=$(git rev-parse --short HEAD)
--build-arg=BUILD_DATE="$(date +"%Y-%m-%d %H:%M:%S%:z")"
--tag ${DOCKER_IMAGE} .
- docker push ${DOCKER_IMAGE}
docker:build:branches:
stage: build
only:
- branches
except:
- master
script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
- docker build
--pull
--cache-from=${DOCKER_IMAGE}:${CI_COMMIT_REF_SLUG}
--build-arg=VCS_REF=$(git rev-parse --short HEAD)
--build-arg=BUILD_DATE="$(date +"%Y-%m-%d %H:%M:%S%:z")"
--tag ${DOCKER_IMAGE}:${CI_COMMIT_REF_SLUG} .
- docker push ${DOCKER_IMAGE}:${CI_COMMIT_REF_SLUG}
docker:build:release:
stage: build
only:
- tags
script:
- docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
- docker build
--pull
--cache-from=${DOCKER_IMAGE}:${VERSION}
--build-arg=VCS_REF=$(git rev-parse --short HEAD)
--build-arg=BUILD_DATE="$(date +"%Y-%m-%d %H:%M:%S%:z")"
--tag ${DOCKER_IMAGE}:${VERSION} .
- docker push ${DOCKER_IMAGE}:${VERSION}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。