Refactored dockerfile

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 7 years ago
parent 615f7eb1c4
commit e1ecc2444c
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 2
      install/docker/.dockerignore
  2. 18
      install/docker/Dockerfile
  3. 1
      install/docker/pom.xml
  4. 23
      install/docker/run.sh

@ -1,4 +1,4 @@
!target/airsonic.war
.gitignore .gitignore
pom.xml pom.xml
target/ target/
!target/dependency/*

@ -3,25 +3,27 @@ FROM alpine:3.6
LABEL description="Airsonic is a free, web-based media streamer, providing ubiquitious access to your music." \ LABEL description="Airsonic is a free, web-based media streamer, providing ubiquitious access to your music." \
url="https://github.com/airsonic/airsonic" url="https://github.com/airsonic/airsonic"
ENV UID=1001 GID=1001 AIRSONIC_PORT=4040 AIRSONIC_DIR=/airsonic ENV AIRSONIC_PORT=4040 AIRSONIC_DIR=/airsonic
WORKDIR $AIRSONIC_DIR WORKDIR $AIRSONIC_DIR
COPY dockerfiles/run.sh /usr/local/bin/run.sh
COPY target/dependency/airsonic-main-6.3-SNAPSHOT.war airsonic.war
RUN apk --no-cache add \ RUN apk --no-cache add \
ffmpeg \ ffmpeg \
lame \ lame \
su-exec \ bash \
libressl \ libressl \
ca-certificates \ ca-certificates \
tini \ tini \
openjdk8-jre \ openjdk8-jre
&& chmod +x /usr/local/bin/run.sh
COPY run.sh /usr/local/bin/run.sh
RUN chmod +x /usr/local/bin/run.sh
COPY target/dependency/airsonic-main-6.3-SNAPSHOT.war airsonic.war
EXPOSE $AIRSONIC_PORT EXPOSE $AIRSONIC_PORT
VOLUME $AIRSONIC_DIR/data $AIRSONIC_DIR/music $AIRSONIC_DIR/playlists $AIRSONIC_DIR/podcasts VOLUME $AIRSONIC_DIR/data $AIRSONIC_DIR/music $AIRSONIC_DIR/playlists $AIRSONIC_DIR/podcasts
ENTRYPOINT ["run.sh"] ENTRYPOINT ["tini", "--", "run.sh"]

@ -39,6 +39,7 @@
<configuration> <configuration>
<repository>airsonic/airsonic</repository> <repository>airsonic/airsonic</repository>
<tag>${project.version}</tag> <tag>${project.version}</tag>
<retryCount>0</retryCount>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>

@ -1,13 +1,18 @@
#!/bin/sh #!/bin/bash
set -e
mkdir -p $AIRSONIC_DIR/data/transcode mkdir -p $AIRSONIC_DIR/data/transcode
ln -s /usr/bin/ffmpeg $AIRSONIC_DIR/data/transcode/ffmpeg ln -fs /usr/bin/ffmpeg $AIRSONIC_DIR/data/transcode/ffmpeg
ln -s /usr/bin/lame $AIRSONIC_DIR/data/transcode/lame ln -fs /usr/bin/lame $AIRSONIC_DIR/data/transcode/lame
chown -R $UID:$GID $AIRSONIC_DIR/data $AIRSONIC_DIR/playlists $AIRSONIC_DIR/podcasts if [[ $# -lt 1 ]] || [[ ! "$1" == "java"* ]]; then
exec su-exec $UID:$GID tini -- \ java_opts_array=()
java -Xmx256m \ while IFS= read -r -d '' item; do
java_opts_array+=( "$item" )
done < <([[ $JAVA_OPTS ]] && xargs printf '%s\0' <<<"$JAVA_OPTS")
exec java -Xmx256m \
-Dserver.host=0.0.0.0 \ -Dserver.host=0.0.0.0 \
-Dserver.port=$AIRSONIC_PORT \ -Dserver.port=$AIRSONIC_PORT \
-Dserver.contextPath=/ \ -Dserver.contextPath=/ \
@ -16,4 +21,8 @@ exec su-exec $UID:$GID tini -- \
-Dairsonic.defaultPodcastFolder=$AIRSONIC_DIR/podcasts \ -Dairsonic.defaultPodcastFolder=$AIRSONIC_DIR/podcasts \
-Dairsonic.defaultPlaylistFolder=$AIRSONIC_DIR/playlists \ -Dairsonic.defaultPlaylistFolder=$AIRSONIC_DIR/playlists \
-Djava.awt.headless=true \ -Djava.awt.headless=true \
-jar airsonic.war "${java_opts_array[@]}" \
-jar airsonic.war "$@"
fi
exec "$@"

Loading…
Cancel
Save