forked from mrjackv/volumio-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
147 lines (102 loc) · 4.6 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
FROM docker.io/library/debian:bullseye as base
ADD scripts/cleanup /usr/bin
RUN apt update && \
apt install -y --no-install-recommends curl gnupg ca-certificates xz-utils && \
curl http://apt.mopidy.com/mopidy.gpg | apt-key add - && \
cleanup
ADD https://apt.mopidy.com/buster.list /etc/apt/sources.list.d/mopidy.list
ENV NODE_VERSION="8.17.0"
ADD scripts/install-node /tmp
RUN /tmp/install-node
ENV PATH=/opt/node/bin:$PATH
FROM base as builder
RUN apt update && \
apt install -y --no-install-recommends \
build-essential \
libavahi-compat-libdnssd-dev \
libudev-dev python git cmake \
libjson-glib-dev libao-dev libdbus-glib-1-dev \
libnotify-dev libsoup2.4-dev libsox-dev libspotify-dev
# Build Volumio Core.
FROM builder as core-builder
ENV CORE_VERSION=65023745b40b190d7586775708defe2c207fba78
ENV CORE_SHA256=e4090fb579119341dc19fba8bf0eae4d33438c8b7c5c68d290c8039b4c669fc1
RUN curl -Lo /tmp/volumio.tar.gz "https://github.com/volumio/Volumio2/archive/$CORE_VERSION.tar.gz" && \
sha256sum /tmp/volumio.tar.gz && \
echo "$CORE_SHA256 /tmp/volumio.tar.gz" | sha256sum --check --status && \
mkdir -p /dist/volumio && \
tar -C /dist/volumio --strip-components=1 -xf /tmp/volumio.tar.gz && \
rm -f /tmp/volumio.tar.gz
# Remove fs-extra package that seems to cause issue on runtime. TBD.
RUN sed -i '/"fs-extra"/d' /dist/volumio/package.json
RUN cd /dist/volumio && \
npm install --save --production [email protected] && \
npm install --production && \
node /dist/volumio/utils/misc/clean-node-modules.js /dist/volumio
# Build Volumio UI.
FROM builder as ui-builder
ENV UI_VERSION=a6f7de9f19757c53f1f52a89a3a75ea75528ba67
ENV UI_SHA256=a69a1351867048d42a987d87190b146a3e5a51933068b14ba11982a5c8fa8710
RUN curl -Lo /tmp/volumio-ui.tar.gz "https://github.com/volumio/Volumio2-UI/archive/$UI_VERSION.tar.gz" && \
sha256sum /tmp/volumio-ui.tar.gz && \
echo "$UI_SHA256 /tmp/volumio-ui.tar.gz" | sha256sum --check --status && \
mkdir -p /tmp/volumio-ui && \
tar -C /tmp/volumio-ui --strip-components=1 -xf /tmp/volumio-ui.tar.gz && \
rm -f /tmp/volumio-ui.tar.gz
ADD credits.js.diff /tmp
ADD scripts/fake-phantomjs /usr/bin/phantomjs
RUN cd /tmp/volumio-ui/src/app/themes/volumio/scripts && \
patch -p1 < /tmp/credits.js.diff && \
cd /tmp/volumio-ui && \
npm install && \
npm install -g bower gulp && \
bower install --allow-root && \
gulp build --theme="volumio" --env="production" && \
mkdir -p /dist && mv /tmp/volumio-ui/dist /dist/volumio
# Build spop from source
FROM builder as spop-builder
WORKDIR /
RUN git clone https://github.com/Schnouki/spop && \
mkdir spop/build && cd spop/build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr .. && \
make all
# Build final image.
FROM base as final
ENV VOLLIBRESPOT_VER=0.2.4
RUN apt update && \
apt install -y --no-install-recommends \
alsa-utils avahi-daemon avahi-utils \
libavahi-compat-libdnssd1 libnss-mdns \
minizip mpc mpd pulseaudio shairport-sync \
sudo wget s6 gosu jq tini systemd psmisc \
libjson-glib-1.0-0 libao4 libdbus-glib-1-2 libnotify4 \
libsoup2.4-1 libsox3 libsox-fmt-all libspotify12 \
&& cleanup
# Add specific user and group (hardcoded).
RUN groupadd -g 1000 volumio && useradd -u 1000 -g 1000 volumio && \
# add users to audio group
usermod -a -G audio volumio && usermod -a -G audio mpd
# Install dist from previous stages.
COPY --from=core-builder /dist/volumio /volumio
COPY --from=ui-builder /dist/volumio /volumio/http/www
# Grab spop
COPY --from=spop-builder /spop/build/spopd /usr/local/bin
COPY --from=spop-builder /spop/build/libspop*.so /usr/local/lib/
# Install Vollibrespot
RUN ARCH="$(lscpu -J | jq -r '.lscpu[0].data')" && \
curl -Lo /tmp/vol.tar.xz "https://github.com/ashthespy/Vollibrespot/releases/download/v${VOLLIBRESPOT_VER}/vollibrespot-${ARCH}.tar.xz" && \
tar xf /tmp/vol.tar.xz -C/usr/bin && rm /tmp/vol.tar.xz
# Symlink library to /mnt for volumio.
RUN rm -rf /mnt && ln -s /var/lib/mpd/music /mnt && \
# Create node symlink in /usr/local (hardcoded).
ln -s /opt/node/bin/node /usr/local/bin/node
# Copy services and config.
COPY etc /etc
# A few additional hacks to finalize the image.
COPY scripts/volumio-image-hacks /tmp/
RUN /tmp/volumio-image-hacks
COPY scripts/entrypoint /entrypoint
COPY scripts/lscpu scripts/dpkg /usr/local/bin/
COPY scripts/fake-systemctl /bin/systemctl
COPY scripts/killall /usr/bin/killall
ENTRYPOINT /entrypoint