chore(docker): Enhance Dockerfile with improved healthcheck and package installation

- Add wget package to base Alpine image for healthcheck functionality
- Increase healthcheck start period from 5s to 40s to allow more startup time
- Ensure robust health verification for application container
- Improve container initialization and readiness detection
This commit is contained in:
ats-tech25 2025-11-07 21:53:07 +00:00
parent a664a145e0
commit 748c30ab8c

View File

@ -25,8 +25,8 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o cli cmd/cli/main.
# Runtime stage
FROM alpine:latest
# Install ca-certificates for HTTPS requests
RUN apk --no-cache add ca-certificates tzdata
# Install ca-certificates for HTTPS requests and wget for healthcheck
RUN apk --no-cache add ca-certificates tzdata wget
WORKDIR /root/
@ -40,8 +40,8 @@ COPY --from=builder /app/internal/templates ./internal/templates
# Expose port (adjust if needed)
EXPOSE 8080
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
# Health check - give more time for startup
HEALTHCHECK --interval=30s --timeout=3s --start-period=40s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
# Run the server