-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
139 lines (112 loc) · 4.17 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
FROM alpine:3.12 AS build
MAINTAINER [email protected]
ARG SC_VERSION="xxx"
RUN apk update && \
apk --no-cache add \
git \
gcc \
g++ \
jack-dev \
fftw-dev \
libsndfile-dev \
cmake \
make \
alsa-lib-dev \
eudev-dev \
linux-headers \
bsd-compat-headers \
readline-dev
RUN mkdir /tmp/supercollider-compile \
&& git clone --recursive --depth 1 --branch ${SC_VERSION} \
git://github.com/supercollider/supercollider \
/tmp/supercollider-compile
# Bump Link to more recent commit than current release of 3.0.2 and update submodules
# This resolves an underlying ASIO compile bug that was fixed upstream
RUN cd /tmp/supercollider-compile/external_libraries/link && git checkout 0b77cc2 && git submodule update
RUN mkdir /tmp/supercollider-compile/build
WORKDIR /tmp/supercollider-compile/build
ARG CC=/usr/bin/gcc
ARG CXX=/usr/bin/g++
RUN cmake -L \
-DCMAKE_BUILD_TYPE="Release" \
-DBUILD_TESTING=OFF \
-DENABLE_TESTSUITE=OFF \
-DSUPERNOVA=OFF \
-DNATIVE=OFF \
-DSSE=OFF \
-DSSE2=OFF \
-DSC_IDE=OFF \
-DSC_QT=OFF \
-DSC_ED=OFF \
-DSC_EL=OFF \
-DINSTALL_HELP=OFF \
-DSC_VIM=ON \
-DNO_AVAHI=ON \
-DNO_X11=ON \
.. \
&& make -j $(nproc) \
&& make install
ARG SC_PLUG_VERSION="xxx"
RUN mkdir /tmp/supercollider-plugs-compile \
&& git clone --recursive --depth 1 --branch ${SC_PLUG_VERSION} \
git://github.com/supercollider/sc3-plugins \
/tmp/supercollider-plugs-compile
RUN mkdir /tmp/supercollider-plugs-compile/build
WORKDIR /tmp/supercollider-plugs-compile/build
RUN cmake -L \
-DCMAKE_BUILD_TYPE="Release" \
-DSUPERNOVA=OFF \
-DNATIVE=OFF \
-DSC_PATH=/tmp/supercollider-compile/ \
.. \
&& make -j $(nproc) \
&& make install
FROM alpine:3.12
RUN apk update && \
apk --no-cache add \
jack \
eudev \
fftw \
libsndfile \
linux-pam \
readline
COPY --from=build /usr/local/include/SuperCollider /usr/local/include/SuperCollider
COPY --from=build /usr/local/share/SuperCollider /usr/local/share/SuperCollider
COPY --from=build /usr/local/lib/SuperCollider /usr/local/lib/SuperCollider
COPY --from=build /usr/local/bin/scsynth /usr/local/bin/scsynth
COPY --from=build /usr/local/bin/sclang /usr/local/bin/sclang
COPY --from=build /usr/local/share/pixmaps/supercollider.png /usr/local/share/pixmaps/supercollider.png
COPY --from=build /usr/local/share/pixmaps/supercollider.xpm /usr/local/share/pixmaps/supercollider.xpm
COPY --from=build /usr/local/share/pixmaps/sc_ide.svg /usr/local/share/pixmaps/sc_ide.svg
COPY --from=build /usr/local/share/mime/packages/supercollider.xml /usr/local/share/mime/packages/supercollider.xml
RUN addgroup sc-user && adduser -D sc-user -G sc-user
# We run the container with device /dev/snd mapped so need to ensure that sc-user is a member
# of the host's audio group
RUN addgroup -g 29 audiorpi && addgroup sc-user audiorpi
RUN mkdir -p /etc/security && \
echo "echo @audiorpi - memlock unlimited" >> /etc/security/limits.d/99-realtime.conf && \
echo "echo @audiorpi - rtprio 99" >> /etc/security/limits.d/99-realtime.conf
RUN mkdir /sc-workdir && chown sc-user:sc-user /sc-workdir
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
WORKDIR /sc-workdir
# Env vars for jackd
ENV JACK_NO_AUDIO_RESERVATION=1 \
JACK_START_SERVER=true \
SC_JACK_DEFAULT_INPUTS=system \
SC_JACK_DEFAULT_OUTPUTS=system \
SC_PLUGIN_PATH=/usr/local/share/SuperCollider/Extensions \
SHORTS=false
# Env vars for scsynth init
ENV CH_OUT=2 \
CH_IN=2 \
SC_SYNTH_PORT=57110 \
SR=48000 \
SC_BLOCK=128 \
HW_BUFF=2048 \
SC_MEM=131072 \
ALSA_DEV="hw:0"
USER sc-user
ENTRYPOINT ["/docker-entrypoint.sh"]
# The following command runs a shell with the scsynth command to ensure that env vars can be interpreted
CMD ["/bin/sh", "-c", "/usr/local/bin/scsynth -B 0.0.0.0 -u ${SC_SYNTH_PORT} -m ${SC_MEM} -D 0 -R 0 -i ${CH_IN} -o ${CH_OUT} -z ${SC_BLOCK}"]