diff --git a/install/docker/.dockerignore b/install/docker/.dockerignore new file mode 100644 index 00000000..f474ef49 --- /dev/null +++ b/install/docker/.dockerignore @@ -0,0 +1,4 @@ +.gitignore +pom.xml +target/ +!target/dependency/* diff --git a/install/docker/Dockerfile b/install/docker/Dockerfile new file mode 100644 index 00000000..dea28398 --- /dev/null +++ b/install/docker/Dockerfile @@ -0,0 +1,29 @@ +FROM alpine:3.6 + +LABEL description="Airsonic is a free, web-based media streamer, providing ubiquitious access to your music." \ + url="https://github.com/airsonic/airsonic" + +ENV AIRSONIC_PORT=4040 AIRSONIC_DIR=/airsonic + +WORKDIR $AIRSONIC_DIR + +RUN apk --no-cache add \ + ffmpeg \ + lame \ + bash \ + libressl \ + ca-certificates \ + tini \ + openjdk8-jre + +COPY run.sh /usr/local/bin/run.sh + +RUN chmod +x /usr/local/bin/run.sh + +COPY target/dependency/airsonic-main.war airsonic.war + +EXPOSE $AIRSONIC_PORT + +VOLUME $AIRSONIC_DIR/data $AIRSONIC_DIR/music $AIRSONIC_DIR/playlists $AIRSONIC_DIR/podcasts + +ENTRYPOINT ["tini", "--", "run.sh"] diff --git a/install/docker/pom.xml b/install/docker/pom.xml new file mode 100644 index 00000000..bea30e32 --- /dev/null +++ b/install/docker/pom.xml @@ -0,0 +1,66 @@ + + + + 4.0.0 + + ../../pom.xml + airsonic + 6.3-SNAPSHOT + org.airsonic.player + + pom + airsonic-docker + Airsonic Docker Image + + + + org.airsonic.player + airsonic-main + 6.3-SNAPSHOT + war + + + + + + + com.spotify + dockerfile-maven-plugin + 1.3.4 + + + default + + build + + package + + + + airsonic/airsonic + ${project.version} + 0 + + + + maven-dependency-plugin + org.apache.maven.plugins + 3.0.1 + + true + true + + + + copy + generate-sources + + copy-dependencies + + + + + + + + diff --git a/install/docker/run.sh b/install/docker/run.sh new file mode 100755 index 00000000..21fc3bfd --- /dev/null +++ b/install/docker/run.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e + +mkdir -p $AIRSONIC_DIR/data/transcode +ln -fs /usr/bin/ffmpeg $AIRSONIC_DIR/data/transcode/ffmpeg +ln -fs /usr/bin/lame $AIRSONIC_DIR/data/transcode/lame + +if [[ $# -lt 1 ]] || [[ ! "$1" == "java"* ]]; then + + java_opts_array=() + 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.port=$AIRSONIC_PORT \ + -Dserver.contextPath=/ \ + -Dairsonic.home=$AIRSONIC_DIR/data \ + -Dairsonic.defaultMusicFolder=$AIRSONIC_DIR/musics \ + -Dairsonic.defaultPodcastFolder=$AIRSONIC_DIR/podcasts \ + -Dairsonic.defaultPlaylistFolder=$AIRSONIC_DIR/playlists \ + -Djava.awt.headless=true \ + "${java_opts_array[@]}" \ + -jar airsonic.war "$@" +fi + +exec "$@" diff --git a/pom.xml b/pom.xml index eecf0c0c..f53ff7bc 100644 --- a/pom.xml +++ b/pom.xml @@ -221,4 +221,16 @@ + + + + docker + + subsonic-rest-api + airsonic-sonos-api + airsonic-main + install/docker + + +