From 728a866173596028387f638a0cb100c4ba862177 Mon Sep 17 00:00:00 2001 From: Ben Sarmiento Date: Thu, 1 Feb 2024 00:41:21 +0100 Subject: [PATCH] Revise dockerfile and healthcheck --- Dockerfile | 20 +++----------------- healthcheck.sh | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index f253d1b..2bba5a7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,27 +7,13 @@ COPY . . RUN apk add --no-cache bash git go gcc musl-dev curl fuse libxml2-utils RUN go build -ldflags "-s -w -X 'github.com/debridmediamanager/zurg/internal/version.BuiltAt=$BuiltAt' -X 'github.com/debridmediamanager/zurg/internal/version.GitCommit=$GitCommit' -X 'github.com/debridmediamanager/zurg/internal/version.Version=$Version'" -o zurg ./cmd/zurg -# Obfuscation stage -FROM alpine:3 AS obfuscator -WORKDIR /app -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 -COPY ./healthcheck.sh /app/healthcheck.sh -RUN chmod +x /app/healthcheck.sh - -# Final stage FROM alpine:3 WORKDIR /app -# Copy the obfuscated binary from the obfuscator stage -COPY --from=obfuscator /app/zurg . -COPY --from=obfuscator /app/healthcheck.sh . - -# Copy the rest of the application files, including the config.yml +COPY --from=builder /app/zurg . +COPY ./healthcheck.sh /app/healthcheck.sh +RUN chmod +x /app/healthcheck.sh COPY config.example.yml /app/config.yml - # Install runtime dependencies and configure FUSE RUN apk add curl python3 diff --git a/healthcheck.sh b/healthcheck.sh index 8a7ff93..e1c95ec 100644 --- a/healthcheck.sh +++ b/healthcheck.sh @@ -1,5 +1,5 @@ #!/bin/sh -response=$(curl -o /dev/null -s -w "%{http_code}" http://localhost:9999/) +response=$(curl -o /dev/null -s -w "%{http_code}" "http://fun.box:9999/http/version.txt") if [ "$response" -eq 200 ]; then exit 0 else