Skip to content

Commit

Permalink
feat: Using S6 Overlay (#28)
Browse files Browse the repository at this point in the history
fixes #21

* initial commit
* use explicit basimage version to satisfy lint
* removing 386 platform
* removing 386 platform
* feat: Using S6 Overlay
* forgot something
  • Loading branch information
tuxpeople authored Dec 14, 2021
1 parent 69da079 commit 187c272
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 38 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ on:
types: [assigned, opened, synchronize, reopened]

env:
PLATFORMS: "linux/amd64,linux/arm/v7,linux/i386,linux/arm64" # Build for which platforms
DOCKER_USER: "tdeutsch" # Which user to use to login to DockerHub
PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64" # Build for which platforms
DOCKER_USER: "tdeutsch" # Which user to use to login to DockerHub

#####
# To rebuild someone else's repo, do this:
Expand Down
28 changes: 12 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.15.0
FROM ghcr.io/tuxpeople/baseimage-alpine:3.14.3

# set args
ARG BUILD_DATE
Expand All @@ -25,27 +25,23 @@ ENV LC_ALL="C.UTF-8"
# RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM"
# RUN echo "$TARGETPLATFORM consists of $TARGETOS, $TARGETARCH and $TARGETVARIANT"

WORKDIR /opt/JDownloader
VOLUME /opt/JDownloader/Downloads
VOLUME /opt/JDownloader/cfg

# Upgrade and install dependencies
# hadolint ignore=DL3018,DL3019
RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk add --no-cache --upgrade openjdk8-jre ca-certificates libstdc++ ffmpeg wget jq moreutils@community tini && \
mkdir -p /init && \
mkdir -p /opt/JDownloader && \
wget -q -O /init/JDownloader.jar --user-agent="Github Docker Image Build (https://github.com/tuxpeople)" "http://installer.jdownloader.org/JDownloader.jar" && \
chmod +x /init/JDownloader.jar && \
chmod -R 777 /opt/JDownloader* /init
apk add --no-cache --upgrade openjdk8-jre ca-certificates libstdc++ ffmpeg wget jq moreutils@community && \
wget -q -O /opt/JDownloader/JDownloader.jar --user-agent="Github Docker Image Build (https://github.com/tuxpeople)" "http://installer.jdownloader.org/JDownloader.jar" && \
chmod +x /opt/JDownloader/JDownloader.jar && \
chmod -R 777 /opt/JDownloader*

# archive extraction uses sevenzipjbinding library
# which is compiled against libstdc++
COPY ./ressources/${TARGETARCH}/*.jar /init/libs/
COPY ./scripts/entrypoint.sh /
COPY ./config/default-config.json.dist /init/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json.dist
COPY ./ressources/${TARGETARCH}/*.jar /opt/JDownloader/libs/
COPY ./root/ /
COPY ./config/default-config.json.dist /opt/JDownloader/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json.dist
COPY ./scripts/configure.sh /usr/bin/configure

EXPOSE 3129
WORKDIR /opt/JDownloader
VOLUME /opt/JDownloader

ENTRYPOINT ["/sbin/tini", "--"]

CMD ["/entrypoint.sh"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ This image allows you to have JDownloader 2 easily installed and controlled via
* **Where to file issues:**
https://github.com/tuxpeople/docker-jdownloader-headless/issues
* **Supported architectures:**
```amd64```, ```armv7```, ```i386``` and ```arm64```
```amd64```, ```armv7``` and ```arm64```

## Image tags
- ```latest``` always refers to the latest tagged release.
Expand Down
23 changes: 4 additions & 19 deletions scripts/entrypoint.sh → root/etc/cont-init.d/30-prepare-jdownloader
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#!/bin/sh

trap 'kill -TERM $PID' TERM INT
rm -f /opt/JDownloader/JDownloader.jar.*
rm -f /opt/JDownloader/JDownloader.pid

SETTINGSFILE="/opt/JDownloader/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json"

# Login user with env credentials - Please prefer command way
Expand All @@ -22,15 +18,11 @@ if [ -f /opt/JDownloader/Downloads/jdownloader-block.txt ]; then
sleep 1000000
fi

ls -latr /opt/JDownloader/

# Check if volume needs init
if [ ! -f /opt/JDownloader/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json.dist ]; then
cp -r /init/* /opt/JDownloader/
# Check if settings file exists
if [ ! -f ${SETTINGSFILE} ]; then
cp /opt/JDownloader/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json.dist ${SETTINGSFILE}
fi

ls -latr /opt/JDownloader/

# Check JDownloader.jar integrity and removes it in case it's not
jar tvf /opt/JDownloader/JDownloader.jar > /dev/null 2>&1
if [ $? -ne 0 ]; then
Expand All @@ -52,11 +44,4 @@ fi
if echo "$UMASK" | grep -Eq '0[0-7]{3}' ; then
echo "Defining umask to $UMASK"
umask "$UMASK"
fi

java -Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar -norestart &
PID=$!
wait $PID
wait $PID

EXIT_STATUS=$?
fi
4 changes: 4 additions & 0 deletions root/etc/services.d/jdownloader/finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/execlineb -S0

rm -f /opt/JDownloader/JDownloader.jar.*
rm -f /opt/JDownloader/JDownloader.pid
2 changes: 2 additions & 0 deletions root/etc/services.d/jdownloader/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/execlineb -P
java -Dsun.jnu.encoding=UTF-8 -Dfile.encoding=UTF-8 -Djava.awt.headless=true -jar /opt/JDownloader/JDownloader.jar -norestart

0 comments on commit 187c272

Please sign in to comment.