Bring back the health check

This commit is contained in:
Ben Sarmiento
2023-11-21 21:21:57 +01:00
parent 6eaefb1b66
commit a536c1f952

View File

@@ -19,6 +19,11 @@ WORKDIR /app
COPY --from=builder /app/zurg . 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
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
# Final stage # Final stage
FROM alpine:3 FROM alpine:3
@@ -26,12 +31,15 @@ WORKDIR /app
# Copy the obfuscated binary from the obfuscator stage # Copy the obfuscated binary from the obfuscator stage
COPY --from=obfuscator /app/zurg . COPY --from=obfuscator /app/zurg .
COPY --from=obfuscator /app/healthcheck.sh .
# Copy the rest of the application files, including the config.yml # Copy the rest of the application files, including the config.yml
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 curl \ RUN apk add --no-cache fuse3 netcat-openbsd yaml-cpp curl \
&& echo 'user_allow_other' >> /etc/fuse.conf && echo 'user_allow_other' >> /etc/fuse.conf
HEALTHCHECK --interval=60s --timeout=60s --start-period=10s --retries=10 CMD /app/healthcheck.sh
ENTRYPOINT ["./zurg"] ENTRYPOINT ["./zurg"]