You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
883 B
29 lines
883 B
1 year ago
|
#!/bin/bash
|
||
|
#version=git log --format='%H' -n1
|
||
|
project_name="hotspot-queue"
|
||
|
version=$(git log --format='%H' -n1)
|
||
|
br=$(git rev-parse --abbrev-ref HEAD)
|
||
|
|
||
|
if [ ! -n "$version" ] ;then
|
||
|
echo "未获取到版本信息"
|
||
|
else
|
||
|
echo "当前分支:$br"
|
||
|
environment=$br
|
||
|
echo "打包的环境:$environment"
|
||
|
echo "打包版本号:$version"
|
||
|
echo "项目名称:$project_name"
|
||
|
|
||
|
# go mod tidy
|
||
|
# make build
|
||
|
|
||
|
echo "======登录镜像仓库======"
|
||
|
docker login -u jumai -p VaHBCfY11cv1 https://harbor.homieyy.com
|
||
|
echo "======build======"
|
||
|
docker build -t harbor.homieyy.com/job/$environment/$project_name:latest .
|
||
|
echo "======tag======="
|
||
|
docker tag harbor.homieyy.com/job/$environment/$project_name:latest harbor.homieyy.com/job/$environment/$project_name:$version
|
||
|
echo "======push======="
|
||
|
docker push harbor.homieyy.com/job/$environment/$project_name:$version
|
||
|
fi
|
||
|
|