mirror of
https://github.com/sinanyuntu/trade-message-center.git
synced 2026-09-17 13:22:11 +08:00
fix: migrate database before container replacement
This commit is contained in:
@@ -192,8 +192,14 @@ jobs:
|
||||
image="$IMAGE_NAME:$IMAGE_TAG"
|
||||
docker pull "$image"
|
||||
mkdir -p "$DEPLOY_PATH"
|
||||
printf '%s\n' "$image" > "$DEPLOY_PATH/current-image"
|
||||
previous_image="$(docker inspect --format '{{.Config.Image}}' "$DEPLOY_CONTAINER_NAME" 2>/dev/null || true)"
|
||||
migration_container="${DEPLOY_CONTAINER_NAME}-migration"
|
||||
docker rm -f "$migration_container" 2>/dev/null || true
|
||||
docker run --rm \
|
||||
--name "$migration_container" \
|
||||
"$image" \
|
||||
node dist/src/database/migrate.js
|
||||
printf '%s\n' "$image" > "$DEPLOY_PATH/current-image"
|
||||
docker rm -f "$DEPLOY_CONTAINER_NAME" 2>/dev/null || true
|
||||
docker run -d \
|
||||
--name "$DEPLOY_CONTAINER_NAME" \
|
||||
|
||||
Reference in New Issue
Block a user