From 36fcad03c546c799614c9416bf9d6c59724c4ca5 Mon Sep 17 00:00:00 2001 From: 0xYYBB | ZYY | Bobo <128128010+the-dev-z@users.noreply.github.com> Date: Sun, 16 Nov 2025 08:26:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(docker):=20revert=20healthcheck=20to=20wget?= =?UTF-8?q?=20for=20Alpine=20compatibility=20(#986)=20##=20Problem=20PR=20?= =?UTF-8?q?#906=20changed=20healthcheck=20commands=20from=20`wget`=20to=20?= =?UTF-8?q?`curl`,=20but=20Alpine=20Linux=20(our=20base=20image)=20does=20?= =?UTF-8?q?not=20include=20`curl`=20by=20default,=20causing=20all=20contai?= =?UTF-8?q?ners=20to=20fail=20healthchecks=20with:=20```=20exec:=20"curl":?= =?UTF-8?q?=20executable=20file=20not=20found=20in=20$PATH=20```=20This=20?= =?UTF-8?q?creates=20a=20configuration=20mismatch:=20-=20docker/Dockerfile?= =?UTF-8?q?.backend=20uses=20`wget`=20(=E2=9C=85=20works)=20-=20docker-com?= =?UTF-8?q?pose.yml=20uses=20`curl`=20(=E2=9D=8C=20fails)=20##=20Root=20Ca?= =?UTF-8?q?use=20Analysis=20Alpine=20Linux=20philosophy=20is=20minimalism:?= =?UTF-8?q?=20-=20=E2=9C=85=20`wget`=20is=20pre-installed=20(part=20of=20b?= =?UTF-8?q?usybox)=20-=20=E2=9D=8C=20`curl`=20requires=20`apk=20add=20curl?= =?UTF-8?q?`=20(~3MB=20extra)=20The=20original=20PR=20#906=20made=20two=20?= =?UTF-8?q?commits:=201.=20First=20commit=20(3af8760):=20`curl`=20?= =?UTF-8?q?=E2=86=92=20`wget`=20(=E2=9C=85=20correct=20fix)=202.=20Second?= =?UTF-8?q?=20commit=20(333b2ef):=20`wget`=20=E2=86=92=20`curl`=20(?= =?UTF-8?q?=E2=9D=8C=20introduced=20bug)=20The=20second=20commit=20was=20b?= =?UTF-8?q?ased=20on=20incorrect=20assumption=20that=20"curl=20is=20more?= =?UTF-8?q?=20widely=20available=20than=20wget=20in=20Docker=20images".=20?= =?UTF-8?q?This=20is=20false=20for=20Alpine.=20##=20Solution=20Revert=20he?= =?UTF-8?q?althcheck=20commands=20back=20to=20`wget`=20to=20match:=201.=20?= =?UTF-8?q?Alpine's=20pre-installed=20tools=202.=20Dockerfile.backend=20he?= =?UTF-8?q?althcheck=20(line=2068)=203.=20Docker=20and=20Kubernetes=20best?= =?UTF-8?q?=20practices=20##=20Testing=20=E2=9C=85=20Verified=20`wget`=20e?= =?UTF-8?q?xists=20in=20Alpine=20containers:=20```bash=20docker=20run=20--?= =?UTF-8?q?rm=20alpine:latest=20which=20wget=20#=20Output:=20/usr/bin/wget?= =?UTF-8?q?=20```=20=E2=9C=85=20Added=20new=20CI=20workflow=20to=20prevent?= =?UTF-8?q?=20regression:=20-=20`.github/workflows/pr-docker-compose-healt?= =?UTF-8?q?hcheck.yml`=20-=20Validates=20healthcheck=20compatibility=20wit?= =?UTF-8?q?h=20Alpine=20-=20Ensures=20containers=20reach=20healthy=20statu?= =?UTF-8?q?s=20##=20Impact=20-=20**Before**:=20Containers=20show=20(unheal?= =?UTF-8?q?thy),=20potential=20auto-restart=20loops=20-=20**After**:=20Con?= =?UTF-8?q?tainers=20show=20(healthy),=20monitoring=20systems=20happy=20-?= =?UTF-8?q?=20**Scope**:=20Only=20affects=20docker-compose=20deployments?= =?UTF-8?q?=20-=20**Breaking**:=20None=20-=20this=20is=20a=20bug=20fix=20#?= =?UTF-8?q?#=20References=20-=20PR=20#906:=20Original=20(incorrect)=20fix?= =?UTF-8?q?=20-=20Alpine=20Linux:=20https://alpinelinux.org/about/=20-=20D?= =?UTF-8?q?ockerfile.backend=20L68:=20Existing=20`wget`=20healthcheck=20Co?= =?UTF-8?q?-authored-by:=20the-dev-z=20=20Co-authored-by:=20tinkle-community=20?= =?UTF-8?q?=20Co-authored-by:=20Shui=20<88711385+hzb1115@users.noreply.git?= =?UTF-8?q?hub.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pr-docker-compose-healthcheck.yml | 152 ++++++++++++++++++ docker-compose.yml | 4 +- 2 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pr-docker-compose-healthcheck.yml diff --git a/.github/workflows/pr-docker-compose-healthcheck.yml b/.github/workflows/pr-docker-compose-healthcheck.yml new file mode 100644 index 00000000..139477e5 --- /dev/null +++ b/.github/workflows/pr-docker-compose-healthcheck.yml @@ -0,0 +1,152 @@ +name: PR Docker Compose Healthcheck + +# 驗證 docker-compose.yml 的 healthcheck 配置在 Alpine 容器中正常工作 +on: + pull_request: + branches: + - main + - dev + paths: + - 'docker-compose.yml' + - 'docker/Dockerfile.backend' + - 'docker/Dockerfile.frontend' + - '.github/workflows/pr-docker-compose-healthcheck.yml' + +jobs: + healthcheck-test: + name: Test Docker Compose Healthcheck + runs-on: ubuntu-22.04 + timeout-minutes: 10 + permissions: + contents: read + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Create minimal .env for testing + run: | + cat > .env < config.json <