This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile.template
70 lines (56 loc) · 1.62 KB
/
Dockerfile.template
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
ARG ALPINE_VERSION=3.14
ARG BALENA_ARCH=%%BALENA_ARCH%%
### Build Snapweb ###
FROM balenalib/$BALENA_ARCH-alpine-node:$ALPINE_VERSION as snapweb-builder
WORKDIR /usr/src
RUN install_packages git make npm
RUN git clone https://github.com/badaix/snapweb.git snapweb
RUN npm install --global --no-save typescript
RUN cd snapweb && make
### Build Snapcast ###
FROM balenalib/$BALENA_ARCH-alpine:$ALPINE_VERSION as snapcast-builder
WORKDIR /usr/src
ENV SNAPCAST_VERSION=0.26.0
RUN install_packages \
alsa-lib-dev \
asio-dev \
avahi-dev \
build-base \
ccache \
cmake \
expat-dev \
flac-dev \
git \
libvorbis-dev \
opus-dev \
soxr-dev
# Build from source
RUN git clone https://github.com/badaix/snapcast.git snapcast
WORKDIR /usr/src/snapcast
RUN git checkout tags/v$SNAPCAST_VERSION
RUN cmake -B build \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=Release
RUN cmake --build build
### Run stage ###
FROM balenalib/$BALENA_ARCH-alpine:$ALPINE_VERSION
WORKDIR /usr/src
# Audio block setup
ENV PULSE_SERVER=tcp:audio:4317
RUN curl --silent https://raw.githubusercontent.com/balenablocks/audio/master/scripts/alsa-bridge/alpine-setup.sh | sh
# Copy files
COPY --from=snapcast-builder /usr/src/snapcast/bin/snap* /usr/bin/
COPY --from=snapweb-builder /usr/src/snapweb/dist/* /var/www/
COPY snapserver.conf /etc/snapserver.conf
COPY entry.sh .
RUN install_packages \
alsa-lib \
avahi-libs \
expat\
flac \
libvorbis \
opus \
soxr
EXPOSE 1704 1705 1780
ENTRYPOINT [ "/bin/bash", "/usr/src/entry.sh" ]
CMD [ "snapserver" ]