bixi
Version:
企业级中后台前端解决方案
48 lines (42 loc) • 1.25 kB
YAML
stages:
- build
cache:
paths:
- node_modules/
variables:
GIT_STRATEGY: none
REPO_NAMESPACE: frontend_utils
REPO_NAME: bixi
before_script:
- docker login -u $REGISTRY_USER -p $REGISTRY_PWD http://dockerhub.datagrand.com
- mkdir $REPO_NAME
- cd $REPO_NAME
- git init
- git remote add origin ssh://git@git.datagrand.com:58422/$REPO_NAMESPACE/$REPO_NAME.git
- git fetch --depth=1 origin $CI_COMMIT_SHA
- git reset --hard FETCH_HEAD
- echo 'commit id full:' $CI_COMMIT_SHA
- echo 'commit user:' $GITLAB_USER_NAME
build_dev:
stage: build
except:
- tags
script:
- cp -r ~/.ssh .
# build
- docker build -t dockerhub.datagrand.com/$REPO_NAMESPACE/$REPO_NAME:$CI_PIPELINE_ID -f docker/Dockerfile .
# push
- docker push dockerhub.datagrand.com/$REPO_NAMESPACE/$REPO_NAME:$CI_PIPELINE_ID
- echo '镜像版本:' $CI_PIPELINE_ID
allow_failure: false
build_release:
stage: build
only:
- tags
script:
# build
- docker build -t dockerhub.datagrand.com/$REPO_NAMESPACE/$REPO_NAME:$CI_COMMIT_TAG -f docker/Dockerfile .
# push
- docker push dockerhub.datagrand.com/$REPO_NAMESPACE/$REPO_NAME:$CI_COMMIT_TAG
- echo '镜像版本:' $CI_COMMIT_TAG
allow_failure: false