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