Skip to content

Commit

Permalink
Merge pull request #16 from sbaier1/upstream_master
Browse files Browse the repository at this point in the history
improve signal handling, alpine
  • Loading branch information
PlusMinus0 committed Jun 28, 2018
2 parents 3df21d4 + 1975ef4 commit 2374e09
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
FROM openjdk:8-jre
FROM openjdk:8-jre-alpine

MAINTAINER PlusMinus <piddlpiddl@gmail.com>


# 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 \
apk add --no-cache --quiet tini su-exec bash && \
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 && \
wget -O /opt/JDownloader/JDownloader.jar --user-agent="https://hub.docker.com/r/plusminus/jdownloader2-headless/" http://installer.jdownloader.org/JDownloader.jar && \
java -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar


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"]
15 changes: 1 addition & 14 deletions startJD2.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 ${USER}:${GROUP} "$@"

0 comments on commit 2374e09

Please sign in to comment.