diff --git a/Dockerfile b/Dockerfile index 296c237..e0d922d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,9 @@ -FROM openjdk:8-jre +FROM openjdk:8-jre-alpine MAINTAINER PlusMinus -# Create directory, downloader JD" and start JD2 for the initial update and creation of config files. +# Create directory, and start JD2 for the initial update and creation of config files. RUN \ mkdir -p /opt/JDownloader/ && \ wget -O /opt/JDownloader/JDownloader.jar --user-agent="https://hub.docker.com/r/plusminus/jdownloader2-headless/" --progress=bar:force http://installer.jdownloader.org/JDownloader.jar && \ @@ -14,5 +14,6 @@ COPY startJD2.sh /opt/JDownloader/ RUN chmod +x /opt/JDownloader/startJD2.sh +ENTRYPOINT ["/sbin/tini", "-g", "--", "/opt/JDownloader/startJD2.sh"] # Run this when the container is started -CMD /opt/JDownloader/startJD2.sh +CMD ["java", "-Djava.awt.headless=true", "-jar", "/opt/JDownloader/JDownloader.jar"] diff --git a/startJD2.sh b/startJD2.sh index 6e68d88..4bf2192 100755 --- a/startJD2.sh +++ b/startJD2.sh @@ -1,12 +1,5 @@ #!/bin/bash -function stopJD2 { - PID=$(cat JDownloader.pid) - kill $PID - wait $PID - exit -} - if [ "$GID" ] && [ "$GID" -ne "0" ] then GROUP=jdownloader @@ -26,11 +19,5 @@ fi useradd -G $GROUP $USER chown -R $USER:$GROUP /opt/JDownloader -trap stopJD2 EXIT - -su -c "java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar &" -s /bin/bash $USER - -while true; do - sleep inf -done +exec su-exec "$@"