47 lines
1.6 KiB
Docker
47 lines
1.6 KiB
Docker
# -------- 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. Runtime stage --------
|
|
FROM debian:bookworm-slim
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
tini gosu libstdc++6 \
|
|
curl ca-certificates unzip jq rsync \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 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
|
|
|
|
# Copy binaries + static UI
|
|
COPY --from=build /tmp/slskd /app/code/slskd
|
|
COPY --from=build /tmp/wwwroot /app/code/wwwroot
|
|
|
|
# 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", "--"]
|
|
CMD ["./start.sh"]
|
|
|