snowy/aliyun-flow-document/api-deployment-script

31 lines
832 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#部署脚本会在部署组的每台机器上执行。一个典型Docker部署脚本如下
#示例中使用的$image是您在脚本下方的变量处定义的变量上游输出或自定义
#docker run $image
#停止原有容器
docker stop $PROJECT_NAME
#移除原有容器
docker rm $PROJECT_NAME
#删除项目名
docker rmi $RELEASE_TAG
#登录阿里云Docker Registry
echo $DOCKER_PASSWORD | docker login --username $DOCKER_USERNAME --password-stdin $REGISTRY_URL
#从Registry中拉取镜像
docker pull $REGISTRY_TAG
#修改镜像名称
docker tag $REGISTRY_TAG $RELEASE_TAG
#删除Registry镜像标签
docker rmi $REGISTRY_TAG
#创建自定义网络
docker network create $NETWORK
#运行镜像
docker run --name $PROJECT_NAME --network $NETWORK --restart=always -dp $EXPOSE_PORT:$INTERNAL_PORT $RELEASE_TAG