Spencer Gardner 1 tydzień temu
rodzic
commit
f850719414
3 zmienionych plików z 23 dodań i 10 usunięć
  1. 2 0
      .dockerignore
  2. 18 8
      Dockerfile
  3. 3 2
      deluge-web_init.sh

+ 2 - 0
.dockerignore

@@ -0,0 +1,2 @@
+*
+!deluge-web_init.sh

+ 18 - 8
Dockerfile

@@ -1,12 +1,22 @@
-FROM ubuntu:22.04
+# syntax=docker/dockerfile:1
+FROM ubuntu:24.04
 
-EXPOSE 80
+ENV DEBIAN_FRONTEND=noninteractive \
+    PYTHONUNBUFFERED=1
+
+RUN apt-get update \
+ && apt-get install -y --no-install-recommends software-properties-common gpg-agent \
+ && add-apt-repository -y ppa:deluge-team/stable \
+ && apt-get install -y --no-install-recommends deluge-web \
+ && apt-get purge -y --auto-remove software-properties-common gpg-agent \
+ && rm -rf /var/lib/apt/lists/*
 
-RUN apt-get update && apt-get install -y software-properties-common
-RUN add-apt-repository ppa:deluge-team/stable -y
-RUN apt-get update && apt-get install -y deluge-web
+COPY --chmod=755 deluge-web_init.sh /usr/local/bin/deluge-web_init.sh
+
+VOLUME ["/config"]
+EXPOSE 80
 
-ADD deluge-web_init.sh /sbin/deluge-web_init.sh
-RUN chmod +x /sbin/deluge-web_init.sh
+HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
+  CMD python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:80/', timeout=4)" || exit 1
 
-CMD /sbin/deluge-web_init.sh
+CMD ["/usr/local/bin/deluge-web_init.sh"]

+ 3 - 2
deluge-web_init.sh

@@ -1,4 +1,5 @@
 #!/bin/sh
+set -eu
 
-
-deluge-web -c /config -p 80 -d -L info
+# exec so deluge-web runs as PID 1 and receives SIGTERM from `docker stop`
+exec deluge-web --config /config --port 80 --do-not-daemonize --loglevel "${LOG_LEVEL:-info}" "$@"