mirror of
https://git.netzspielplatz.de/docker-multiarch/jdownloader2-headless.git
synced 2025-11-08 19:09:31 +00:00
Restructured some things and made 1000:100 the default user. Added debian base image, tests and update README.md
This commit is contained in:
parent
0084476349
commit
e96b9d994f
10 changed files with 126 additions and 54 deletions
23
Dockerfile
23
Dockerfile
|
|
@ -1,23 +0,0 @@
|
||||||
FROM openjdk:8-jre-alpine
|
|
||||||
|
|
||||||
MAINTAINER PlusMinus <piddlpiddl@gmail.com>
|
|
||||||
|
|
||||||
|
|
||||||
# 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/libs && \
|
|
||||||
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 && \
|
|
||||||
apk add --update ffmpeg
|
|
||||||
|
|
||||||
# Beta sevenzipbindings
|
|
||||||
COPY sevenzip* /opt/JDownloader/
|
|
||||||
|
|
||||||
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 ["java", "-Djava.awt.headless=true", "-jar", "/opt/JDownloader/JDownloader.jar"]
|
|
||||||
|
|
@ -36,7 +36,7 @@ Headless JDownloader 2 Docker Container
|
||||||
## Optional environment variables
|
## Optional environment variables
|
||||||
|Environment Variable|Description|
|
|Environment Variable|Description|
|
||||||
|--------------------|-----------|
|
|--------------------|-----------|
|
||||||
|UID|Specifies the UID the daemon should run as. All created files will be owned by this UID. Defaults to 0 for root.|
|
|UID|Specifies the UID the daemon should run as. All created files will be owned by this UID. Defaults to 1000.|
|
||||||
|GID|Specifies the GID for all created files. This only works in combination with the UID. Defaults to 0 for root.|
|
|GID|Specifies the GID for all created files. This only works in combination with the UID. Defaults to 100 for users.|
|
||||||
|
|
||||||
Not setting these will default to root:root. If you are required to set all environment varibles, setting these to 0 will fall back to the default.
|
Not setting these will default to 1000:100.
|
||||||
|
|
|
||||||
19
alpine.Dockerfile
Normal file
19
alpine.Dockerfile
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
FROM openjdk:8-jre-alpine
|
||||||
|
|
||||||
|
MAINTAINER PlusMinus <piddlpiddl@gmail.com>
|
||||||
|
|
||||||
|
# Create directory, and start JD2 for the initial update and creation of config files.
|
||||||
|
RUN apk update && apk upgrade && \
|
||||||
|
apk add --no-cache --quiet tini su-exec shadow ffmpeg && \
|
||||||
|
mkdir -p /opt/JDownloader/libs && \
|
||||||
|
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
|
||||||
|
|
||||||
|
# Beta sevenzipbindings and entrypoint
|
||||||
|
COPY common/* /opt/JDownloader/
|
||||||
|
RUN chmod +x /opt/JDownloader/entrypoint.sh
|
||||||
|
|
||||||
|
|
||||||
|
ENTRYPOINT ["tini", "-g", "--", "/opt/JDownloader/entrypoint.sh"]
|
||||||
|
# Run this when the container is started
|
||||||
|
CMD ["java", "-Djava.awt.headless=true", "-jar", "/opt/JDownloader/JDownloader.jar"]
|
||||||
21
build-n-test.sh
Executable file
21
build-n-test.sh
Executable file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
images=('alpine' 'debian')
|
||||||
|
|
||||||
|
if [ "$(docker version --format '{{.Server.Experimental}}')" = 'true' ]; then
|
||||||
|
export DOCKER_BUILDKIT=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
for image in "${images[@]}"; do
|
||||||
|
tag="jd2dev:${image}"
|
||||||
|
|
||||||
|
echo "Building $tag"
|
||||||
|
docker build -t $tag -f $image.Dockerfile .
|
||||||
|
|
||||||
|
echo "Testing image"
|
||||||
|
dgoss run $tag
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
32
common/entrypoint.sh
Executable file
32
common/entrypoint.sh
Executable file
|
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Set defaults for uid and gid to not be root
|
||||||
|
if [ -n $GID ]; then GID=100; fi
|
||||||
|
if [ -n $UID ]; then UID=1000; fi
|
||||||
|
|
||||||
|
if [ "$GID" -ne "0" ]; then
|
||||||
|
GROUP=jdownloader
|
||||||
|
groupadd -g $GID $GROUP
|
||||||
|
else
|
||||||
|
GROUP=root
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$UID" -ne "0" ]; then
|
||||||
|
USER=jdownloader
|
||||||
|
|
||||||
|
# Create user without home (-M) and remove login shell
|
||||||
|
useradd -M -s /bin/false -g $GID -u $UID $USER
|
||||||
|
else
|
||||||
|
USER=root
|
||||||
|
usermod -ag $GID
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R $UID:$GID /opt/JDownloader
|
||||||
|
|
||||||
|
# Sometimes this gets deleted. Just copy it every time.
|
||||||
|
cp /opt/JDownloader/sevenzip* /opt/JDownloader/libs/
|
||||||
|
|
||||||
|
su-exec ${UID}:${GID} "$@"
|
||||||
|
|
||||||
|
# Keep container alive when jd2 restarts
|
||||||
|
while sleep 3600; do :; done
|
||||||
23
debian.Dockerfile
Normal file
23
debian.Dockerfile
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
FROM openjdk:11-jre-slim-sid
|
||||||
|
|
||||||
|
MAINTAINER PlusMinus <piddlpiddl@gmail.com>
|
||||||
|
|
||||||
|
# Create directory, and start JD2 for the initial update and creation of config files.
|
||||||
|
RUN apt-get update && apt-get dist-upgrade -yqq && \
|
||||||
|
apt-get install -yqq tini ffmpeg wget make gcc && \
|
||||||
|
mkdir -p /opt/JDownloader/libs && \
|
||||||
|
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 && \
|
||||||
|
mkdir -p /tmp/ && \
|
||||||
|
wget -O /tmp/su-exec.tar.gz https://github.com/ncopa/su-exec/archive/v0.2.tar.gz && \
|
||||||
|
cd /tmp/ && tar -xf su-exec.tar.gz && cd su-exec-0.2 && make && cp su-exec /usr/bin &&\
|
||||||
|
apt-get purge -yqq wget make gcc && apt-get autoremove -yqq && cd / && rm -rf tmp
|
||||||
|
|
||||||
|
# Beta sevenzipbindings and entrypoint
|
||||||
|
COPY common/* /opt/JDownloader/
|
||||||
|
RUN chmod +x /opt/JDownloader/entrypoint.sh
|
||||||
|
|
||||||
|
|
||||||
|
ENTRYPOINT ["tini", "-g", "--", "/opt/JDownloader/entrypoint.sh"]
|
||||||
|
# Run this when the container is started
|
||||||
|
CMD ["java", "-Djava.awt.headless=true", "-jar", "/opt/JDownloader/JDownloader.jar"]
|
||||||
28
goss.yaml
Normal file
28
goss.yaml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
file:
|
||||||
|
/opt/JDownloader/JDownloader.jar:
|
||||||
|
exists: true
|
||||||
|
mode: "0644"
|
||||||
|
filetype: file
|
||||||
|
contains: []
|
||||||
|
/opt/JDownloader/sevenzipjbinding1509.jar:
|
||||||
|
exists: true
|
||||||
|
mode: "0644"
|
||||||
|
filetype: file
|
||||||
|
contains: []
|
||||||
|
/opt/JDownloader/sevenzipjbinding1509Linux.jar:
|
||||||
|
exists: true
|
||||||
|
mode: "0644"
|
||||||
|
filetype: file
|
||||||
|
contains: []
|
||||||
|
package:
|
||||||
|
ffmpeg:
|
||||||
|
installed: true
|
||||||
|
user:
|
||||||
|
jdownloader:
|
||||||
|
exists: true
|
||||||
|
uid: 1000
|
||||||
|
gid: 100
|
||||||
|
groups:
|
||||||
|
- users
|
||||||
|
home: []
|
||||||
|
shell: /bin/false
|
||||||
28
startJD2.sh
28
startJD2.sh
|
|
@ -1,28 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ "$GID" ] && [ "$GID" -ne "0" ]
|
|
||||||
then
|
|
||||||
GROUP=jdownloader
|
|
||||||
addgroup -g $GID $GROUP
|
|
||||||
else
|
|
||||||
GROUP=root
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$UID" ] && [ "$UID" -ne "0" ]
|
|
||||||
then
|
|
||||||
USER=jdownloader
|
|
||||||
adduser -S -D -s /bin/false -u $UID $USER
|
|
||||||
else
|
|
||||||
USER=root
|
|
||||||
fi
|
|
||||||
|
|
||||||
adduser -G $GROUP $USER
|
|
||||||
chown -R $USER:$GROUP /opt/JDownloader
|
|
||||||
|
|
||||||
# Sometimes this gets deleted. Just copy it every time.
|
|
||||||
cp /opt/JDownloader/sevenzip* /opt/JDownloader/libs/
|
|
||||||
|
|
||||||
su-exec ${USER}:${GROUP} "$@"
|
|
||||||
|
|
||||||
# Keep container alive when jd2 restarts
|
|
||||||
while sleep 3600; do :; done
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue