Skip to content

Commit fc6aea4

Browse files
AchoArnoldCopilot
andcommitted
fix(tests): use curl instead of wget for Docker health checks
Alpine's busybox wget may not work reliably for HTTP health checks in Docker containers. Switch to curl which is the industry standard for container health checks. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 370d1c0 commit fc6aea4

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

.github/workflows/integration-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
echo "Waiting for API to be healthy..."
3939
for i in $(seq 1 40); do
40-
if docker compose exec api wget -q -O /dev/null http://localhost:8000/health 2>/dev/null; then
40+
if docker compose exec api curl -sf http://localhost:8000/health >/dev/null 2>&1; then
4141
echo "API is healthy!"
4242
break
4343
fi

api/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$GI
2121

2222
FROM alpine:latest
2323

24-
RUN addgroup -S http-sms && adduser -S http-sms -G http-sms
24+
RUN apk add --no-cache curl && addgroup -S http-sms && adduser -S http-sms -G http-sms
2525

2626
USER http-sms
2727
WORKDIR /home/http-sms

tests/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ services:
5757
environment:
5858
FIREBASE_CREDENTIALS: "${FIREBASE_CREDENTIALS}"
5959
healthcheck:
60-
test:
61-
["CMD", "wget", "-q", "-O", "/dev/null", "http://localhost:8000/health"]
60+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
6261
interval: 5s
6362
timeout: 10s
6463
retries: 20

0 commit comments

Comments
 (0)