feat(docker): 将 APP_VERSION 构建进镜像,解决 Watchtower 更新后版本号显示不准的问题 (#200)
CI/CD Pipeline / Validate Code Quality And Tests (push) Failing after 9s
CI/CD Pipeline / Production Browser E2E (push) Failing after 1625h20m41s
CI/CD Pipeline / Deploy Production (push) Failing after 1625h20m43s
CI/CD Pipeline / Staging API Integration Tests (push) Failing after 1625h20m43s
CI/CD Pipeline / Staging E2E Tests (push) Failing after 1625h20m43s
CI/CD Pipeline / Build Production Runtime Images (push) Failing after 1625h20m45s
CI/CD Pipeline / Build & Push Staging (Watchtower auto-deploy) (push) Failing after 1625h20m45s
CI/CD Pipeline / Frontend Lint (push) Has been skipped

This commit was merged in pull request #200.
This commit is contained in:
2026-07-10 22:07:25 +08:00
parent 48e5077191
commit 4ab641f765
3 changed files with 18 additions and 15 deletions
+4 -2
View File
@@ -57,6 +57,7 @@ fi
echo "=== Building API image ==="
if [ "$USE_CACHE" -eq 1 ]; then
docker buildx build \
--build-arg APP_VERSION="$VERSION" \
--cache-from "type=registry,ref=${CACHE_REGISTRY}/api-cache:${CACHE_TAG},ignore-error=true" \
--cache-to "type=registry,ref=${CACHE_REGISTRY}/api-cache:${CACHE_TAG},mode=max" \
-f infra/docker/api.Dockerfile \
@@ -64,12 +65,13 @@ if [ "$USE_CACHE" -eq 1 ]; then
--load \
.
else
docker build --pull=false -f infra/docker/api.Dockerfile -t "$API_IMAGE" -t "$API_LATEST" .
docker build --pull=false --build-arg APP_VERSION="$VERSION" -f infra/docker/api.Dockerfile -t "$API_IMAGE" -t "$API_LATEST" .
fi
echo "=== Building Worker image ==="
if [ "$USE_CACHE" -eq 1 ]; then
docker buildx build \
--build-arg APP_VERSION="$VERSION" \
--cache-from "type=registry,ref=${CACHE_REGISTRY}/worker-cache:${CACHE_TAG},ignore-error=true" \
--cache-to "type=registry,ref=${CACHE_REGISTRY}/worker-cache:${CACHE_TAG},mode=max" \
-f infra/docker/worker.Dockerfile \
@@ -77,7 +79,7 @@ if [ "$USE_CACHE" -eq 1 ]; then
--load \
.
else
docker build --pull=false -f infra/docker/worker.Dockerfile -t "$WORKER_IMAGE" -t "$WORKER_LATEST" .
docker build --pull=false --build-arg APP_VERSION="$VERSION" -f infra/docker/worker.Dockerfile -t "$WORKER_IMAGE" -t "$WORKER_LATEST" .
fi
echo "=== Building Web image (with buildx cache) ==="