chore: 添加 docker 镜像构建脚本

This commit is contained in:
RockYang 2023-06-23 07:08:16 +08:00
parent 05bdd81646
commit 1795a891ce
2 changed files with 31 additions and 0 deletions

31
docker/build.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
version=$1
# build go api
cd ../api/go
make clean linux
# build web app
cd ../../web
npm run build
cd ../docker
# remove docker image if exists
docker rmi chatgpt-plus-go:$version
# build docker image for chatgpt-plus-go
docker build -t chatgpt-plus-go:$version -f dockerfile-api-go ../
# build docker image for chatgpt-plus-vue
docker rmi chatgpt-plus-vue:$version
docker build -t chatgpt-plus-vue:$version -f dockerfile-vue ../
# add tag for aliyum docker registry
goImageId=`docker images |grep chatgpt-plus-go |grep $version |awk '{print $3}'`
docker rmi registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-go:$version
docker tag $goImageId registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-go:$version
vueImageId=`docker images |grep chatgpt-plus-vue |grep $version |awk '{print $3}'`
docker rmi registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-vue:$version
docker tag $vueImageId registry.cn-hangzhou.aliyuncs.com/geekmaster/chatgpt-plus-vue:$version