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 upx --brute zurg
|
||||
# Create a health check script that extracts the port from the config file
|
||||
RUN echo $'#!/bin/sh\n\
|
||||
port=$(yaml read /app/config.yml port)\n\
|
||||
nc -z localhost $port || exit 1' > /app/healthcheck.sh && \
|
||||
chmod +x /app/healthcheck.sh
|
||||
COPY ./healthcheck.sh /app/healthcheck.sh
|
||||
RUN chmod +x /app/healthcheck.sh
|
||||
|
||||
# Final stage
|
||||
FROM alpine:3
|
||||
@@ -37,8 +35,7 @@ COPY --from=obfuscator /app/healthcheck.sh .
|
||||
COPY config.example.yml /app/config.yml
|
||||
|
||||
# Install runtime dependencies and configure FUSE
|
||||
RUN apk add --no-cache fuse3 netcat-openbsd yaml-cpp curl \
|
||||
&& echo 'user_allow_other' >> /etc/fuse.conf
|
||||
RUN apk add curl
|
||||
|
||||
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