Skip to content

Commit d5dacef

Browse files
committed
Make Docker healthcheck configurable via environment variables
Add environment variables to allow customization of healthcheck parameters: - HEALTHCHECK_INTERVAL (default: 2m) - HEALTHCHECK_TIMEOUT (default: 10s) - HEALTHCHECK_START_PERIOD (default: 2m) - HEALTHCHECK_RETRIES (default: 3) This allows users to adjust healthcheck behavior for their specific needs, especially for large database migrations that may take longer during upgrades.
1 parent c22204e commit d5dacef

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

Dockerfile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,16 @@ LABEL maintainer="[email protected]"
4646

4747
EXPOSE 22 3000
4848

49-
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
49+
# Set default healthcheck parameters (can be overridden at runtime)
50+
ENV HEALTHCHECK_INTERVAL=2m \
51+
HEALTHCHECK_TIMEOUT=10s \
52+
HEALTHCHECK_START_PERIOD=2m \
53+
HEALTHCHECK_RETRIES=3
54+
55+
HEALTHCHECK --interval=${HEALTHCHECK_INTERVAL} \
56+
--timeout=${HEALTHCHECK_TIMEOUT} \
57+
--start-period=${HEALTHCHECK_START_PERIOD} \
58+
--retries=${HEALTHCHECK_RETRIES} \
5059
CMD curl -f http://localhost:3000/api/healthz || exit 1
5160

5261
RUN apk --no-cache add \

Dockerfile.rootless

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,16 @@ LABEL maintainer="[email protected]"
4444

4545
EXPOSE 2222 3000
4646

47-
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
47+
# Set default healthcheck parameters (can be overridden at runtime)
48+
ENV HEALTHCHECK_INTERVAL=2m \
49+
HEALTHCHECK_TIMEOUT=10s \
50+
HEALTHCHECK_START_PERIOD=2m \
51+
HEALTHCHECK_RETRIES=3
52+
53+
HEALTHCHECK --interval=${HEALTHCHECK_INTERVAL} \
54+
--timeout=${HEALTHCHECK_TIMEOUT} \
55+
--start-period=${HEALTHCHECK_START_PERIOD} \
56+
--retries=${HEALTHCHECK_RETRIES} \
4857
CMD curl -f http://localhost:3000/api/healthz || exit 1
4958

5059
RUN apk --no-cache add \

0 commit comments

Comments
 (0)