15 lines
680 B
Bash
Executable File
15 lines
680 B
Bash
Executable File
#!/bin/bash
|
||
name=${1%%\\*}
|
||
#进入对应服务目录
|
||
cd server/$name
|
||
#构建二进制文件
|
||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ./bin/api-$name-srv ./$name.go
|
||
#删除之前旧的镜像
|
||
docker rmi -f api-$name-srv:latest
|
||
docker rmi -f registry.cn-hangzhou.aliyuncs.com/fusen/fusen_docker_hub:latest
|
||
#打包docker镜像
|
||
docker build -t api-$name-srv:latest .
|
||
#打tag(测试环境,正式把fusen-test改成fusen)
|
||
docker tag api-$name-srv:latest registry.cn-hangzhou.aliyuncs.com/fusen-test/$name:latest
|
||
#推送到阿里云镜像库(测试环境,正式把fusen-test改成fusen)
|
||
docker push registry.cn-hangzhou.aliyuncs.com/fusen-test/$name:latest |