-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathDockerfile
75 lines (59 loc) · 2.72 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
# syntax=docker/dockerfile:1
# Builder image. It builds the venv that will be copied to the final image
#
ARG BASE_IMAGE_VERSION=latest
FROM ghcr.io/music-assistant/base:$BASE_IMAGE_VERSION AS builder
# create venv which will be copied to the final image
ENV VIRTUAL_ENV=/app/venv
RUN uv venv $VIRTUAL_ENV
ADD dist dist
COPY requirements_all.txt .
# pre-install ALL requirements into the venv
# comes at a cost of a slightly larger image size but is faster to start
# because we do not have to install dependencies at runtime
# ensure UV is installed
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN uv pip install \
--find-links "https://wheels.home-assistant.io/musllinux/" \
-r requirements_all.txt
# Install Music Assistant from prebuilt wheel
ARG MASS_VERSION
RUN uv pip install \
--no-cache \
--find-links "https://wheels.home-assistant.io/musllinux/" \
"music-assistant@dist/music_assistant-${MASS_VERSION}-py3-none-any.whl"
# we need to set (very permissive) permissions to the workdir
# and /tmp to allow running the container as non-root
# IMPORTANT: chmod here, NOT on the final image, to avoid creating extra layers and increase size!
#
RUN chmod -R 777 /app
##################################################################################################
# FINAL docker image for music assistant server
FROM ghcr.io/music-assistant/base:$BASE_IMAGE_VERSION
ENV VIRTUAL_ENV=/app/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# copy the already build /app dir
COPY --from=builder /app /app
# the /app contents have correct permissions but for some reason /app itself does not.
# so apply again, but ONLY to the dir (otherwise we increase the size)
RUN chmod 777 /app
# Set some labels
ARG MASS_VERSION
ARG TARGETPLATFORM
LABEL \
org.opencontainers.image.title="Music Assistant Server" \
org.opencontainers.image.description="Music Assistant is a free, opensource Media library manager that connects to your streaming services and a wide range of connected speakers. The server is the beating heart, the core of Music Assistant and must run on an always-on device like a Raspberry Pi, a NAS or an Intel NUC or alike." \
org.opencontainers.image.source="https://github.com/music-assistant/server" \
org.opencontainers.image.authors="The Music Assistant Team" \
org.opencontainers.image.documentation="https://music-assistant.io" \
org.opencontainers.image.licenses="Apache License 2.0" \
io.hass.version="${MASS_VERSION}" \
io.hass.type="addon" \
io.hass.name="Music Assistant Server" \
io.hass.description="Music Assistant Server" \
io.hass.platform="${TARGETPLATFORM}" \
io.hass.type="addon"
VOLUME [ "/data" ]
EXPOSE 8095
WORKDIR $VIRTUAL_ENV
ENTRYPOINT ["mass", "--config", "/data"]