Add proper health check
This commit is contained in:
@@ -20,10 +20,8 @@ COPY --from=builder /app/zurg .
|
|||||||
# RUN apk add --no-cache upx
|
# RUN apk add --no-cache upx
|
||||||
# RUN upx --brute zurg
|
# RUN upx --brute zurg
|
||||||
# Create a health check script that extracts the port from the config file
|
# Create a health check script that extracts the port from the config file
|
||||||
RUN echo $'#!/bin/sh\n\
|
COPY ./healthcheck.sh /app/healthcheck.sh
|
||||||
port=$(yaml read /app/config.yml port)\n\
|
RUN chmod +x /app/healthcheck.sh
|
||||||
nc -z localhost $port || exit 1' > /app/healthcheck.sh && \
|
|
||||||
chmod +x /app/healthcheck.sh
|
|
||||||
|
|
||||||
# Final stage
|
# Final stage
|
||||||
FROM alpine:3
|
FROM alpine:3
|
||||||
@@ -37,8 +35,7 @@ COPY --from=obfuscator /app/healthcheck.sh .
|
|||||||
COPY config.example.yml /app/config.yml
|
COPY config.example.yml /app/config.yml
|
||||||
|
|
||||||
# Install runtime dependencies and configure FUSE
|
# Install runtime dependencies and configure FUSE
|
||||||
RUN apk add --no-cache fuse3 netcat-openbsd yaml-cpp curl \
|
RUN apk add curl
|
||||||
&& echo 'user_allow_other' >> /etc/fuse.conf
|
|
||||||
|
|
||||||
HEALTHCHECK --interval=60s --timeout=60s --start-period=10s --retries=10 CMD /app/healthcheck.sh
|
HEALTHCHECK --interval=60s --timeout=60s --start-period=10s --retries=10 CMD /app/healthcheck.sh
|
||||||
|
|
||||||
|
|||||||
7
healthcheck.sh
Normal file
7
healthcheck.sh
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
response=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:9999)
|
||||||
|
if [ "$response" -eq 200 ]; then
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user