-
Notifications
You must be signed in to change notification settings - Fork 86
/
Dockerfile
74 lines (59 loc) · 2.1 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
FROM debian:buster-slim
RUN set -ex \
# Official Mopidy install for Debian/Ubuntu along with some extensions
# (see https://docs.mopidy.com/en/latest/installation/debian/ )
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
curl \
dumb-init \
gnupg \
gstreamer1.0-alsa \
gstreamer1.0-plugins-bad \
python3-crypto \
python3-distutils \
&& curl -L https://bootstrap.pypa.io/get-pip.py | python3 - \
&& pip install pipenv \
# Clean-up
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache
RUN set -ex \
&& curl -L https://apt.mopidy.com/mopidy.gpg | apt-key add - \
&& curl -L https://apt.mopidy.com/mopidy.list -o /etc/apt/sources.list.d/mopidy.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
mopidy \
mopidy-soundcloud \
mopidy-spotify \
# Clean-up
&& apt-get purge --auto-remove -y \
gcc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ~/.cache
COPY Pipfile Pipfile.lock /
RUN set -ex \
&& pipenv install --system --deploy
RUN set -ex \
&& mkdir -p /var/lib/mopidy/.config \
&& ln -s /config /var/lib/mopidy/.config/mopidy
# Start helper script.
COPY entrypoint.sh /entrypoint.sh
# Default configuration.
COPY mopidy.conf /config/mopidy.conf
# Copy the pulse-client configuratrion.
COPY pulse-client.conf /etc/pulse/client.conf
# Allows any user to run mopidy, but runs by default as a randomly generated UID/GID.
ENV HOME=/var/lib/mopidy
RUN set -ex \
&& usermod -G audio,sudo mopidy \
&& chown mopidy:audio -R $HOME /entrypoint.sh \
&& chmod go+rwx -R $HOME /entrypoint.sh
# Runs as mopidy user by default.
USER mopidy
# Basic check,
RUN /usr/bin/dumb-init /entrypoint.sh /usr/bin/mopidy --version
VOLUME ["/var/lib/mopidy/local", "/var/lib/mopidy/media"]
EXPOSE 6600 6680 5555/udp
ENTRYPOINT ["/usr/bin/dumb-init", "/entrypoint.sh"]
CMD ["/usr/bin/mopidy"]
HEALTHCHECK --interval=5s --timeout=2s --retries=20 \
CMD curl --connect-timeout 5 --silent --show-error --fail http://localhost:6680/ || exit 1