From a28c4cf9cdd0793e4418eaabc6cd2d24034833c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=97=AA=D1=94=CE=BD=CE=B9=CE=B7=20=E1=97=B7=CF=85=D0=BD?= =?UTF-8?q?=CA=9F?= Date: Thu, 1 Apr 2021 09:47:45 -0400 Subject: [PATCH] distribution/containers: suggest env as a possible alternative to args (#262) Co-authored-by: Jesse Chan --- README.md | 2 ++ distribution/containers/Dockerfile.distroless | 11 +++++++++-- distribution/containers/Dockerfile.release | 3 ++- distribution/containers/Dockerfile.rtorrent | 2 +- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cd0ff38e..270a4043 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,8 @@ Note that you have to let Docker know which port should be exposed (e.g. `-p 300 Don't forget to pay attention to `flood`'s arguments like `--port` and `--allowedpath`. +Alternatively, you can pass in environment variables instead (e.g. `-e FLOOD_OPTION_port=3000`). + Checkout [Run Flood (and torrent clients) in containers](https://github.com/jesec/flood/discussions/120) discussion. Filesystem parts in [Troubleshooting](https://github.com/jesec/flood#troubleshooting) are especially important for containers. diff --git a/distribution/containers/Dockerfile.distroless b/distribution/containers/Dockerfile.distroless index 26966d28..8fd44a99 100644 --- a/distribution/containers/Dockerfile.distroless +++ b/distribution/containers/Dockerfile.distroless @@ -6,6 +6,7 @@ WORKDIR /root # Install Flood and dependencies to /bin RUN mkdir -p /root/sysroot/bin + COPY ./artifacts artifacts RUN if [[ `uname -m` == "aarch64" ]]; \ then mv artifacts/flood-linux-arm64 flood; \ @@ -13,7 +14,12 @@ RUN if [[ `uname -m` == "aarch64" ]]; \ then mv artifacts/flood-linux-x64 flood; \ fi RUN mv flood /root/sysroot/bin/flood + COPY --from=busybox /bin/busybox_DF /root/sysroot/bin/df + +RUN apk --no-cache add tini-static +RUN cp /sbin/tini-static /root/sysroot/bin/tini + RUN chmod 0555 /root/sysroot/bin/* # Create 1001:1001 user @@ -33,7 +39,8 @@ USER 1001:1001 EXPOSE 3000 # Flood -ENTRYPOINT ["flood", "--host=0.0.0.0"] +ENV FLOOD_OPTION_HOST="0.0.0.0" +ENTRYPOINT ["/bin/tini", "--", "flood"] # rtorrent-flood image FROM jesec/rtorrent:master as rtorrent @@ -43,4 +50,4 @@ FROM flood as rtorrent-flood COPY --from=rtorrent / / # Flood with managed rTorrent daemon -ENTRYPOINT ["flood", "--host=0.0.0.0", "--rtorrent"] +ENV FLOOD_OPTION_RTORRENT="true" diff --git a/distribution/containers/Dockerfile.release b/distribution/containers/Dockerfile.release index 32a80007..5cc0b483 100644 --- a/distribution/containers/Dockerfile.release +++ b/distribution/containers/Dockerfile.release @@ -25,4 +25,5 @@ USER download EXPOSE 3000 # Flood -ENTRYPOINT ["/sbin/tini", "--", "flood", "--host=0.0.0.0"] +ENV FLOOD_OPTION_HOST="0.0.0.0" +ENTRYPOINT ["/sbin/tini", "--", "flood"] diff --git a/distribution/containers/Dockerfile.rtorrent b/distribution/containers/Dockerfile.rtorrent index a992f037..c373251c 100644 --- a/distribution/containers/Dockerfile.rtorrent +++ b/distribution/containers/Dockerfile.rtorrent @@ -9,4 +9,4 @@ FROM jesec/flood:$FLOOD_VERSION as flood COPY --from=rtorrent / / # Flood with managed rTorrent daemon -ENTRYPOINT ["/sbin/tini", "--", "flood", "--host=0.0.0.0", "--rtorrent"] +ENV FLOOD_OPTION_RTORRENT="true"