diff --git a/Dockerfile b/Dockerfile index b812777..f880835 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,21 @@ -FROM ubuntu:trusty +FROM ubuntu:bionic EXPOSE 4050 EXPOSE 4051 RUN apt-get update && \ apt-get install -y wget && \ - apt-get install -y openjdk-7-jre-headless wget supervisor && \ - wget -O /tmp/subsonic.deb https://s3-eu-west-1.amazonaws.com/subsonic-public/download/subsonic-6.1.beta2.deb && \ + apt-get install -y openjdk-8-jre-headless wget sudo + +RUN wget -qO /tmp/subsonic.deb https://s3-eu-west-1.amazonaws.com/subsonic-public/download/subsonic-6.1.beta2.deb && \ dpkg -i /tmp/subsonic.deb && \ useradd subsonic && \ mkdir /var/subsonic/lucene2 && \ - chown -R subsonic:subsonic /var/subsonic + chown -R subsonic:subsonic /var/subsonic && \ + mkdir /tools && \ + wget -qO /tools/hsqldb-1.8.0.5.jar http://repo1.maven.org/maven2/hsqldb/hsqldb/1.8.0.5/hsqldb-1.8.0.5.jar && \ + wget -qO /tools/sqltool-2.0.0.jar http://repo1.maven.org/maven2/org/hsqldb/sqltool/2.0.0/sqltool-2.0.0.jar -ADD supervisor.conf /etc/supervisor/conf.d/supervisor.conf -ADD subsonic.conf /etc/supervisor/conf.d/subsonic.conf +ADD start /start +ENTRYPOINT ["/start"] -ENTRYPOINT ["supervisord"] diff --git a/start b/start new file mode 100755 index 0000000..f80b231 --- /dev/null +++ b/start @@ -0,0 +1,16 @@ +#!/bin/bash + +set -ex + +# Run database optimization (if the db already exists) +if [ -f /var/subsonic/db/subsonic.properties ] ; then + cd /var/subsonic/db/ + sudo -Hu subsonic java -cp :/tools/sqltool-2.0.0.jar:/tools/hsqldb-1.8.0.5.jar org.hsqldb.cmdline.SqlTool --inlineRc=url=jdbc:hsqldb:file:subsonic --driver org.hsqldb.jdbcDriver --sql "SHUTDOWN COMPACT;" +fi + + +# Start the main service +cd /usr/share/subsonic +chown -R subsonic:subsonic /var/subsonic +sudo -Hu subsonic java -Xmx256m -Dsubsonic.home=/var/subsonic -Dsubsonic.host=0.0.0.0 -Dsubsonic.port=4051 -Dsubsonic.httpsPort=4050 -Dsubsonic.contextPath=/ -Dsubsonic.defaultMusicFolder=/var/music -Dsubsonic.defaultPodcastFolder=/var/music/Podcast -Dsubsonic.defaultPlaylistFolder=/var/playlists -Djava.awt.headless=true -verbose:gc -jar subsonic-booter-jar-with-dependencies.jar + diff --git a/subsonic.conf b/subsonic.conf deleted file mode 100644 index 8f662fa..0000000 --- a/subsonic.conf +++ /dev/null @@ -1,5 +0,0 @@ -[program:subsonic] -command=java -Xmx256m -Dsubsonic.home=/var/subsonic -Dsubsonic.host=0.0.0.0 -Dsubsonic.port=4051 -Dsubsonic.httpsPort=4050 -Dsubsonic.contextPath=/ -Dsubsonic.defaultMusicFolder=/var/music -Dsubsonic.defaultPodcastFolder=/var/music/Podcast -Dsubsonic.defaultPlaylistFolder=/var/playlists -Djava.awt.headless=true -verbose:gc -jar subsonic-booter-jar-with-dependencies.jar -autorestart=true -user=subsonic -directory=/usr/share/subsonic diff --git a/supervisor.conf b/supervisor.conf deleted file mode 100644 index 54296b8..0000000 --- a/supervisor.conf +++ /dev/null @@ -1,2 +0,0 @@ -[supervisord] -nodaemon=true