From 1b118cf0b7eb4e711fff8bcf7afff4087eec735f Mon Sep 17 00:00:00 2001 From: Morgan Wattiez Date: Wed, 30 Apr 2025 20:06:44 +0200 Subject: [PATCH] chore: ship curl/unzip/jq in runtime image and translate comments to English --- Dockerfile.cloudron | 65 +++++++++++++++++++++++---------------------- VERSION | 2 +- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/Dockerfile.cloudron b/Dockerfile.cloudron index 26ff872..8107889 100644 --- a/Dockerfile.cloudron +++ b/Dockerfile.cloudron @@ -1,43 +1,44 @@ -# 1) Télécharger et unzipper slskd -FROM debian:bookworm-slim AS downloader -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - curl ca-certificates unzip jq \ - && rm -rf /var/lib/apt/lists/* +# -------- 1. Build stage: fetch latest slskd -------- +FROM debian:bookworm-slim AS build +RUN apt-get update && apt-get install -y --no-install-recommends \ + curl ca-certificates unzip jq \ + && rm -rf /var/lib/apt/lists/* + WORKDIR /tmp ARG TARGETPLATFORM -RUN TAG=$(curl -fsSL https://api.github.com/repos/slskd/slskd/releases/latest \ - | jq -r '.tag_name') \ - && case "${TARGETPLATFORM}" in \ - "linux/amd64") URL="https://github.com/slskd/slskd/releases/download/${TAG}/slskd-${TAG}-linux-x64.zip" ;; \ - "linux/arm64") URL="https://github.com/slskd/slskd/releases/download/${TAG}/slskd-${TAG}-linux-arm64.zip" ;; \ - *) echo "Unsupported PLATFORM: ${TARGETPLATFORM}" >&2; exit 1 ;; \ - esac \ - && curl -fsSL "$URL" -o slskd.zip \ - && unzip slskd.zip -# 2) Image finale +RUN TAG=$(curl -fsSL https://api.github.com/repos/slskd/slskd/releases/latest | jq -r '.tag_name') && \ + case "${TARGETPLATFORM}" in \ + "linux/amd64") URL="https://github.com/slskd/slskd/releases/download/${TAG}/slskd-${TAG}-linux-x64.zip" ;; \ + "linux/arm64") URL="https://github.com/slskd/slskd/releases/download/${TAG}/slskd-${TAG}-linux-arm64.zip" ;; \ + *) echo "Unsupported platform ${TARGETPLATFORM}" >&2; exit 1 ;; \ + esac && \ + curl -fsSL "$URL" -o slskd.zip && \ + unzip slskd.zip + +# -------- 2. Runtime stage -------- FROM debian:bookworm-slim -RUN apt-get update \ - && apt-get install -y --no-install-recommends \ - tini jq ca-certificates gosu libstdc++6 \ - && rm -rf /var/lib/apt/lists/* -# Créer les répertoires code, data et cache -RUN mkdir -p /app/code /app/data /run/slskd/cache \ - && useradd -u 1000 -m -d /app/data -s /bin/bash cloudron \ - && chown -R cloudron:cloudron /app/data /run/slskd/cache +RUN apt-get update && apt-get install -y --no-install-recommends \ + tini gosu libstdc++6 \ + curl ca-certificates unzip jq \ + && rm -rf /var/lib/apt/lists/* -# Copier binaire + UI statique -COPY --from=downloader /tmp/slskd /app/code/slskd -COPY --from=downloader /tmp/wwwroot /app/code/wwwroot +# Minimal filesystem layout +RUN mkdir -p /app/code /app/data /run/slskd/cache && \ + useradd -u 1000 -m -d /app/data -s /bin/bash cloudron && \ + chown -R cloudron:cloudron /app/data /run/slskd/cache -# Copier config example et script de démarrage -COPY slskd.yml.example /app/code/slskd.yml.example -COPY start.sh /app/code/start.sh +# Copy binaries + static UI +COPY --from=build /tmp/slskd /app/code/slskd +COPY --from=build /tmp/wwwroot /app/code/wwwroot -RUN chmod +x /app/code/slskd /app/code/start.sh \ - && chown -R cloudron:cloudron /app/code +# Config + startup +COPY slskd.yml.example /app/code/slskd.yml.example +COPY start.sh /app/code/start.sh + +RUN chmod +x /app/code/slskd /app/code/start.sh && \ + chown -R cloudron:cloudron /app/code WORKDIR /app/code ENTRYPOINT ["/usr/bin/tini", "--"] diff --git a/VERSION b/VERSION index ee90284..90a27f9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.4 +1.0.5