feat(scripts): 增强部署脚本支持不同构建模式和环境配置
添加对多种构建模式的支持,包括不构建、重新构建、拉取最新镜像等 默认环境从prod改为test,并支持根据环境加载对应的.env文件
This commit is contained in:
parent
c35be14167
commit
30d64d4eb0
|
|
@ -1,4 +1,18 @@
|
|||
#!/usr/bin/env sh
|
||||
set -e
|
||||
ENV=${1:-prod}
|
||||
APP_ENV=$ENV docker compose up -d --build
|
||||
ENV=${1:-test}
|
||||
MODE=${2:-no-build}
|
||||
ENVFILE=""
|
||||
if [ -f ".env.$ENV" ]; then ENVFILE="--env-file .env.$ENV"; fi
|
||||
case "$MODE" in
|
||||
no-build)
|
||||
APP_ENV=$ENV docker compose $ENVFILE up -d ;;
|
||||
rebuild)
|
||||
APP_ENV=$ENV docker compose $ENVFILE build --no-cache
|
||||
APP_ENV=$ENV docker compose $ENVFILE up -d ;;
|
||||
pull)
|
||||
APP_ENV=$ENV docker compose $ENVFILE build --pull
|
||||
APP_ENV=$ENV docker compose $ENVFILE up -d ;;
|
||||
build|*)
|
||||
APP_ENV=$ENV docker compose $ENVFILE up -d --build ;;
|
||||
esac
|
||||
|
|
|
|||
Loading…
Reference in New Issue