clouddreamai-cicd-setup 1.5.7 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/docker-compose/nestjs.yml +1 -3
- package/templates/docker-compose/vue.yml +1 -3
- package/templates/gitlab-ci/nestjs-gitlab.yml +4 -4
- package/templates/gitlab-ci/vue-gitlab.yml +4 -4
- package/templates/scripts/deploy.sh +1 -1
- package/templates/scripts/generate-env.sh +2 -2
package/package.json
CHANGED
|
@@ -161,8 +161,8 @@ deploy_dev:
|
|
|
161
161
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
162
162
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
163
163
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$TEST_SERVER_HOST:$DEPLOY_DIR/
|
|
164
|
-
# 传递 GitLab Registry
|
|
165
|
-
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
164
|
+
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
165
|
+
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
166
166
|
environment:
|
|
167
167
|
name: development
|
|
168
168
|
url: "{{DEV_URL}}"
|
|
@@ -192,8 +192,8 @@ deploy_prod:
|
|
|
192
192
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
193
193
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
194
194
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$PROD_SERVER_HOST:$DEPLOY_DIR/
|
|
195
|
-
# 传递 GitLab Registry
|
|
196
|
-
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
195
|
+
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
196
|
+
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
197
197
|
environment:
|
|
198
198
|
name: production
|
|
199
199
|
url: "{{PROD_URL}}"
|
|
@@ -161,8 +161,8 @@ deploy_dev:
|
|
|
161
161
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
162
162
|
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
163
163
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$TEST_SERVER_HOST:$DEPLOY_DIR/
|
|
164
|
-
# 传递 GitLab Registry
|
|
165
|
-
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
164
|
+
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
165
|
+
- sshpass -p "$SSH_PASSWORD" ssh root@$TEST_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
166
166
|
environment:
|
|
167
167
|
name: development
|
|
168
168
|
url: "{{DEV_URL}}"
|
|
@@ -192,8 +192,8 @@ deploy_prod:
|
|
|
192
192
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "mkdir -p $DEPLOY_DIR"
|
|
193
193
|
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "which rsync || apk add --no-cache rsync"
|
|
194
194
|
- sshpass -p "$SSH_PASSWORD" rsync -avz --delete --exclude='.git/' --exclude='node_modules/' . root@$PROD_SERVER_HOST:$DEPLOY_DIR/
|
|
195
|
-
# 传递 GitLab Registry
|
|
196
|
-
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
195
|
+
# 传递 GitLab Registry 凭据和镜像名到部署服务器
|
|
196
|
+
- sshpass -p "$SSH_PASSWORD" ssh root@$PROD_SERVER_HOST "export REGISTRY_URL='$CI_REGISTRY' && export REGISTRY_USERNAME='$CI_REGISTRY_USER' && export REGISTRY_PASSWORD='$CI_REGISTRY_PASSWORD' && export DOCKER_IMAGE='$CI_REGISTRY_IMAGE:latest' && export APP_PORT='$APP_PORT' && cd $DEPLOY_DIR && chmod +x ci/deploy.sh && bash ci/deploy.sh $ENV_TYPE gitlab"
|
|
197
197
|
environment:
|
|
198
198
|
name: production
|
|
199
199
|
url: "{{PROD_URL}}"
|
|
@@ -181,7 +181,7 @@ else
|
|
|
181
181
|
echo "找到 Dockerfile,进行本地构建..."
|
|
182
182
|
export DOCKER_IMAGE="$APP_NAME:local"
|
|
183
183
|
docker build -t $DOCKER_IMAGE .
|
|
184
|
-
APP_PORT=$APP_PORT docker-compose up -d
|
|
184
|
+
DOCKER_IMAGE=$DOCKER_IMAGE APP_PORT=$APP_PORT docker-compose up -d
|
|
185
185
|
else
|
|
186
186
|
echo "错误:无法拉取镜像且未找到 Dockerfile,部署失败"
|
|
187
187
|
exit 1
|
|
@@ -9,8 +9,8 @@ ENV_FILE=".env"
|
|
|
9
9
|
|
|
10
10
|
echo "正在生成 $ENV_TYPE 环境的环境变量文件..."
|
|
11
11
|
|
|
12
|
-
# 检查是否在CI
|
|
13
|
-
if [ -n "$
|
|
12
|
+
# 检查是否在CI环境中运行(通过检查 ENV_FILE_CONTENT 或 CI 变量)
|
|
13
|
+
if [ -n "$ENV_FILE_CONTENT" ] || [ -n "$CI" ]; then
|
|
14
14
|
echo "在CI/CD环境中运行,使用CI/CD变量..."
|
|
15
15
|
|
|
16
16
|
# 检查是否有文件类型的环境变量
|