Merge pull request #8 from sparklyballs/alpine

rebase to alpine linux
This commit is contained in:
sparklyballs 2016-09-17 10:25:57 +01:00 committed by GitHub
commit 4fd71a0d8c
13 changed files with 195 additions and 165 deletions

View File

@ -1,120 +1,114 @@
FROM linuxserver/baseimage
MAINTAINER sparklyballs <sparklyballs@linuxserver.io>
FROM lsiobase/alpine
MAINTAINER sparklyballs
ENV APTLIST="avahi-daemon libavahi-client3 libav-tools libantlr3c-3.2-0 \
libconfuse0 libgcrypt20 libgnutls28 libjson0 libmp3lame0 libprotobuf-c0 \
libmxml1 libplist1 libunistring0"
# package version
ARG DAAPD_VER="24.1"
ENV BUILD_APTLIST="antlr3 autoconf autotools-dev automake build-essential cmake gawk gettext git-core gperf \
libasound2-dev libantlr3c-dev libavahi-client-dev libavcodec-dev libavfilter-dev libavformat-dev \
libavutil-dev libconfuse-dev libgcrypt11-dev libgnutls28-dev libjson0-dev libplist-dev libprotobuf-c0-dev \
libreadline-dev libtool libunistring-dev libswscale-dev libmxml-dev zlib1g-dev"
# install runtime packages
RUN \
apk add --no-cache \
avahi \
confuse \
dbus \
ffmpeg \
json-c \
libcurl \
libevent \
libgcrypt \
libplist \
libunistring \
protobuf-c \
sqlite \
sqlite-libs && \
apk add --no-cache \
--repository http://nl.alpinelinux.org/alpine/edge/testing \
libantlr3c \
mxml && \
# set source versions
ENV CURL_VER="7.47.1" LIBEVENT_VER="2.1.5-beta" TAGLIB_VER="1.9.1" SQLITE_VER="autoconf-3110000"
# install build packages
apk add --no-cache --virtual=build-dependencies \
alsa-lib-dev \
autoconf \
automake \
avahi-dev \
bash \
bsd-compat-headers \
confuse-dev \
curl \
curl-dev \
ffmpeg-dev \
file \
flac-dev \
g++ \
gcc \
gettext-dev \
gnutls-dev \
gperf \
json-c-dev \
libcurl \
libevent-dev \
libgcrypt-dev \
libogg-dev \
libplist-dev \
libtool \
libunistring-dev \
make \
openjdk8-jre-base \
protobuf-c-dev \
sqlite-dev \
taglib-dev \
tar && \
apk add --no-cache --virtual=build-dependencies2 \
--repository http://nl.alpinelinux.org/alpine/edge/testing \
libantlr3c-dev \
mxml-dev && \
# add excludes file
ADD defaults/excludes /etc/dpkg/dpkg.cfg.d/excludes
# make antlr wrapper
mkdir -p \
/tmp/source/forked-daapd && \
echo \
"#!/bin/bash" > /tmp/source/antlr3 && \
echo \
"exec java -cp /tmp/source/antlr-3.4-complete.jar org.antlr.Tool \"\$@\"" >> /tmp/source/antlr3 && \
chmod a+x /tmp/source/antlr3 && \
# install build dependencies
RUN apt-get update && \
apt-get install $APTLIST \
$BUILD_APTLIST -qy && \
# fetch source code
mkdir -p /tmp/curl /tmp/taglib /tmp/libevent /tmp/sqlite /tmp/spotify && \
curl -o /tmp/curl.tar.gz -L http://curl.haxx.se/download/curl-$CURL_VER.tar.gz && \
curl -o /tmp/taglib.tar.gz -L http://taglib.github.io/releases/taglib-$TAGLIB_VER.tar.gz && \
curl -o /tmp/libevent.tar.gz -L https://qa.debian.org/watch/sf.php/levent/libevent-$LIBEVENT_VER.tar.gz && \
curl -o /tmp/sqlite.tar.gz -L https://www.sqlite.org/2016/sqlite-$SQLITE_VER.tar.gz && \
curl -o /tmp/spotify_tar.gz -L https://developer.spotify.com/download/libspotify/libspotify-12.1.51-Linux-x86_64-release.tar.gz && \
tar xvf /tmp/curl.tar.gz -C /tmp/curl --strip-components=1 && \
tar xvf /tmp/taglib.tar.gz -C /tmp/taglib --strip-components=1 && \
tar xvf /tmp/libevent.tar.gz -C /tmp/libevent --strip-components=1 && \
tar xvf /tmp/sqlite.tar.gz -C /tmp/sqlite --strip-components=1 && \
tar xvf /tmp/spotify_tar.gz -C /tmp/spotify --strip-components=1 && \
git clone https://github.com/ejurgensen/forked-daapd.git /tmp/forked-daapd && \
# build curl package
cd /tmp/curl && \
./configure \
--prefix=/usr \
--with-ssl \
--with-zlib && \
make && \
make install && \
# build taglib package
cd /tmp/taglib && \
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_RELEASE_TYPE=Release . && \
make && \
make install && \
ldconfig && \
# build libevent package
cd /tmp/libevent && \
./configure && \
make && \
make install && \
# build sqlite package
cd /tmp/sqlite && \
sed -i '/^AM_CFLAGS =/ s/$/ -DSQLITE_ENABLE_UNLOCK_NOTIFY/' /tmp/sqlite/Makefile.in && \
sed -i '/^AM_CFLAGS =/ s/$/ -DSQLITE_ENABLE_UNLOCK_NOTIFY/' /tmp/sqlite/Makefile.am && \
./configure && \
make && \
make install && \
# build spotify
cd /tmp/spotify && \
make install prefix=/usr && \
# configure and build forked-daapd
cd /tmp/forked-daapd && \
autoreconf -i && \
./configure \
--enable-itunes \
--enable-mpd \
--enable-lastfm \
--enable-spotify \
--enable-chromecast \
--prefix=/app \
--sysconfdir=/etc \
--localstatedir=/var && \
make && \
make install && \
cd / && \
# clean build dependencies
apt-get purge --remove \
$BUILD_APTLIST -y && \
apt-get -y autoremove && \
# install runtime dependencies
apt-get update -q && \
apt-get install \
$APTLIST -qy && \
# compile forked-daapd
curl -o \
/tmp/source/antlr-3.4-complete.jar -L \
http://www.antlr3.org/download/antlr-3.4-complete.jar && \
curl -o \
/tmp/source/forked.tar.gz -L \
"https://github.com/ejurgensen/forked-daapd/archive/${DAAPD_VER}.tar.gz" && \
tar xf /tmp/source/forked.tar.gz -C \
/tmp/source/forked-daapd --strip-components=1 && \
export PATH="/tmp/source:$PATH" && \
cd /tmp/source/forked-daapd && \
autoreconf -i -v && \
./configure \
--build=$CBUILD \
--enable-chromecast \
--enable-itunes \
--enable-lastfm \
--enable-mpd \
--host=$CHOST \
--infodir=/usr/share/info \
--localstatedir=/var \
--mandir=/usr/share/man \
--prefix=/app \
--sysconfdir=/etc && \
make && \
make install && \
cp /etc/forked-daapd.conf /etc/forked-daapd.conf.orig && \
# cleanup
apt-get clean && rm -rf /tmp/* /var/lib/apt/lists/* /var/tmp/*
apk del --purge \
build-dependencies \
build-dependencies2 && \
rm -rf \
/tmp/*
# Adding Custom files
ADD init/ /etc/my_init.d/
ADD services/ /etc/service/
RUN chmod -v +x /etc/service/*/run /etc/my_init.d/*.sh && \
# copy local files
COPY root/ /
# tweak config for forked-daapd
mv /etc/forked-daapd.conf /defaults/forked-daapd.conf && \
sed -i -e 's/\(uid.*=\).*/\1 \"abc\"/g' /defaults/forked-daapd.conf && \
sed -i s#"My Music on %h"#"LS.IO Music"#g /defaults/forked-daapd.conf && \
sed -i s#"ipv6 = yes"#"ipv6 = no"#g /defaults/forked-daapd.conf && \
sed -i s#/srv/music#/music#g /defaults/forked-daapd.conf && \
sed -i s#/var/cache/forked-daapd/songs3.db#/config/dbase_and_logs/songs3.db#g /defaults/forked-daapd.conf && \
sed -i s#/var/cache/forked-daapd/cache.db#/config/dbase_and_logs/cache.db#g /defaults/forked-daapd.conf && \
sed -i s#/var/log/forked-daapd.log#/config/dbase_and_logs/forked-daapd.log#g /defaults/forked-daapd.conf && \
sed -i "/db_path\ =/ s/# *//" /defaults/forked-daapd.conf && \
sed -i "/cache_path\ =/ s/# *//" /defaults/forked-daapd.conf
# set volumes
# ports and volumes
VOLUME /config /music

View File

@ -1,22 +1,32 @@
![https://linuxserver.io](https://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png)
[linuxserverurl]: https://linuxserver.io
[forumurl]: https://forum.linuxserver.io
[ircurl]: https://www.linuxserver.io/index.php/irc/
[podcasturl]: https://www.linuxserver.io/index.php/category/podcast/
The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring easy user mapping and community support. Find us for support at:
* [forum.linuxserver.io](https://forum.linuxserver.io)
* [IRC](https://www.linuxserver.io/index.php/irc/) on freenode at `#linuxserver.io`
* [Podcast](https://www.linuxserver.io/index.php/category/podcast/) covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation!
[![linuxserver.io](https://www.linuxserver.io/wp-content/uploads/2015/06/linuxserver_medium.png)][linuxserverurl]
# lsiodev/daapd
![](https://raw.githubusercontent.com/linuxserver/beta-templates/master/lsiodev/img/daapd-git.png)
The [LinuxServer.io][linuxserverurl] team brings you another container release featuring easy user mapping and community support. Find us for support at:
* [forum.linuxserver.io][forumurl]
* [IRC][ircurl] on freenode at `#linuxserver.io`
* [Podcast][podcasturl] covers everything to do with getting the most from your Linux Server plus a focus on all things Docker and containerisation!
DAAP (iTunes) media server with support for AirPlay devices, Apple Remote (and compatibles), Spotify, Chromecast, MPD and internet radio. [Forked-daapd](https://ejurgensen.github.io/forked-daapd/)
# linuxserver/daapd
[Forked-Daapd][daapdurl] (iTunes) media server with support for AirPlay devices, Apple Remote (and compatibles), Chromecast, MPD and internet radio.
[![daapd](https://raw.githubusercontent.com/linuxserver/beta-templates/master/lsiodev/img/daapd-git.png)][daapdurl]
[daapdurl]: https://ejurgensen.github.io/forked-daapd/
## Usage
```
docker create --name=daapd -v <path to data>:/config \
-v <path to music>:/music -e PGID=<gid> -e PUID=<uid> \
--net=host lsiodev/daapd
docker create \
--name=daapd \
-v <path to data>:/config \
-v <path to music>:/music \
-e PGID=<gid> -e PUID=<uid> \
--net=host \
linuxserver/daapd
```
**Parameters**
@ -27,7 +37,7 @@ docker create --name=daapd -v <path to data>:/config \
* `-e PGID` for GroupID - see below for explanation
* `-e PUID` for UserID - see below for explanation
It is based on phusion-baseimage with ssh removed, for shell access whilst the container is running do `docker exec -it daapd /bin/bash`.
It is based on alpine linux with s6 overlay, for shell access whilst the container is running do `docker exec -it daapd /bin/bash`.
### User / Group Identifiers
@ -43,7 +53,7 @@ In this instance `PUID=1001` and `PGID=1001`. To find yours use `id user` as bel
## Setting up the application
Map your music folder, open up itunes on the same LAN to see your music there.
For further setup options of remotes etc, check out the daapd website, [Forked-daapd](https://ejurgensen.github.io/forked-daapd/).
For further setup options of remotes etc, check out the daapd website, [Forked-daapd][daapdurl].
## Logs and shell
* To monitor the logs of the container in realtime `docker logs -f daapd`.
@ -51,8 +61,8 @@ For further setup options of remotes etc, check out the daapd website, [Forked-d
## Versions
+ **28.02.2016:** Add chromecast support, bump dependency versions.
+ **04.01.2016:** Disable ipv6 by default because in v23.4 it doesn't work in unraid with it set.
+ **17.12.2015:** Add in spotify support.
+ **25.11.2015:** Initial Release.
+ **17.08.16:** Rebase to alpine linux, remove redundant spotify support.
+ **28.02.16:** Add chromecast support, bump dependency versions.
+ **04.01.16:** Disable ipv6 by default because in v23.4 it doesn't work in unraid with it set.
+ **17.12.15:** Add in spotify support.
+ **25.11.15:** Initial Release.

View File

@ -1,13 +0,0 @@
path-exclude /usr/share/doc/*
# we need to keep copyright files for legal reasons
path-include /usr/share/doc/*/copyright
path-exclude /usr/share/man/*
path-exclude /usr/share/groff/*
path-exclude /usr/share/info/*
# lintian stuff is small, but really unnecessary
path-exclude /usr/share/lintian/*
path-exclude /usr/share/linda/*
# Drop locales except English
path-exclude=/usr/share/locale/*
path-include=/usr/share/locale/en/*
path-include=/usr/share/locale/locale.alias

View File

@ -1,8 +0,0 @@
#!/bin/bash
[[ -e /var/run/dbus/pid ]] && rm -f /var/run/dbus/pid
mkdir -p /var/run/dbus
chown messagebus:messagebus /var/run/dbus
dbus-uuidgen --ensure
sleep 1

View File

@ -1,8 +0,0 @@
#!/bin/bash
[[ ! -f /config/forked-daapd.conf ]] && cp /defaults/forked-daapd.conf /config/forked-daapd.conf
[[ ! -L /etc/forked-daapd.conf && -f /etc/forked-daapd.conf ]] && rm /etc/forked-daapd.conf
[[ ! -L /etc/forked-daapd.conf ]] && ln -s /config/forked-daapd.conf /etc/forked-daapd.conf
mkdir -p /config/dbase_and_logs /daapd-pidfolder
chown -R abc:abc /config /daapd-pidfolder /app

View File

@ -0,0 +1,7 @@
#!/usr/bin/with-contenv bash
[[ -e /var/run/dbus.pid ]] && \
rm -f /var/run/dbus.pid
dbus-uuidgen --ensure
sleep 1

View File

@ -0,0 +1,37 @@
#!/usr/bin/with-contenv bash
# make folders
mkdir -p \
/config/dbase_and_logs \
/daapd-pidfolder
# configure defaults copy of conf
if [ ! -e "/defaults/forked-daapd.conf" ]; then
cp /etc/forked-daapd.conf.orig /defaults/forked-daapd.conf
sed -i \
-e "/cache_path\ =/ s/# *//" \
-e "/db_path\ =/ s/# *//" \
-e s#"ipv6 = yes"#"ipv6 = no"#g \
-e s#"My Music on %h"#"LS.IO Music"#g \
-e s#/srv/music#/music#g \
-e 's/\(uid.*=\).*/\1 \"abc\"/g' \
-e s#/var/cache/forked-daapd/cache.db#/config/dbase_and_logs/cache.db#g \
-e s#/var/cache/forked-daapd/songs3.db#/config/dbase_and_logs/songs3.db#g \
-e s#/var/log/forked-daapd.log#/config/dbase_and_logs/forked-daapd.log#g \
/defaults/forked-daapd.conf
fi
# symlink conf to /conf
[[ ! -f /config/forked-daapd.conf ]] && \
cp /defaults/forked-daapd.conf /config/forked-daapd.conf
[[ ! -L /etc/forked-daapd.conf && -f /etc/forked-daapd.conf ]] && \
rm /etc/forked-daapd.conf
[[ ! -L /etc/forked-daapd.conf ]] && \
ln -s /config/forked-daapd.conf /etc/forked-daapd.conf
# permissions
chown -R abc:abc \
/app \
/config \
/daapd-pidfolder

View File

@ -0,0 +1,8 @@
#!/usr/bin/with-contenv bash
until [[ -e /var/run/dbus/system_bus_socket ]]; do
sleep 1s
done
exec \
avahi-daemon --no-chroot

View File

@ -0,0 +1,6 @@
#!/usr/bin/with-contenv bash
exec \
dbus-daemon --system --nofork

View File

@ -0,0 +1,5 @@
#!/usr/bin/with-contenv bash
exec \
s6-setuidgid abc /app/sbin/forked-daapd -f \
-P /daapd-pidfolder/forked-daapd.pid

View File

@ -1,3 +0,0 @@
#!/bin/bash
exec avahi-daemon --no-chroot

View File

@ -1,3 +0,0 @@
#!/bin/bash
exec dbus-daemon --system --nofork

View File

@ -1,2 +0,0 @@
#!/bin/bash
exec /sbin/setuser abc /app/sbin/forked-daapd -f -P /daapd-pidfolder/forked-daapd.pid