This repository has been archived by the owner on Sep 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
238 lines (215 loc) · 5.48 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
FROM alpine
MAINTAINER JAremko <w3techplaygound@gmail.com>
LABEL BROWSERMAX=tothemax
ENV XPRA_REV="15743"
COPY /sbin/cleanup /usr/local/sbin/cleanup
# Update
RUN echo "http://nl.alpinelinux.org/alpine/edge/testing" \
>> /etc/apk/repositories \
&& echo "http://nl.alpinelinux.org/alpine/edge/community" \
>> /etc/apk/repositories \
&& apk --no-cache upgrade \
&& cleanup
# Generic stuff
RUN apk --no-cache add \
bash \
coreutils \
git \
wget \
&& cleanup
RUN wget -O /usr/local/ship-it-right-now.jpg \
http://c1.staticflickr.com/4/3007/3582044425_940fbd8171.jpg
# su-exec
RUN apk --no-cache add build-base \
&& git clone https://github.com/ncopa/su-exec.git /tmp/su-exec \
&& cd /tmp/su-exec \
&& make \
&& chmod 770 su-exec \
&& mv su-exec /usr/sbin/ \
# Cleanup
&& apk del build-base \
&& cleanup
# Default fonts
ENV NNG_URL="https://github.com/google/fonts/raw/master/ofl/\
nanumgothic/NanumGothic-Regular.ttf" \
SCP_URL="https://github.com/adobe-fonts/source-code-pro/\
archive/2.030R-ro/1.050R-it.tar.gz"
RUN apk --no-cache add \
fontconfig \
wget \
&& mkdir -p /usr/share/fonts \
&& wget -qO- "${SCP_URL}" | tar xz -C /usr/share/fonts \
&& wget -q "${NNG_URL}" -P /usr/share/fonts \
&& fc-cache -fv \
# Cleanup
&& apk del wget \
&& cleanup
# Emacs
RUN apk --no-cache add emacs-x11 \
&& cleanup
# User
ENV UNAME="spacemacser" \
GNAME="xpra" \
UHOME="/home/emacs" \
UID="1000" \
GID="1000" \
SHELL="/bin/bash"
RUN echo "${UNAME}:x:${UID}:${GID}:${UNAME},,,:${UHOME}:${SHELL}" \
>> /etc/passwd \
&& echo "${UNAME}::17032:0:99999:7:::" \
>> /etc/shadow \
&& echo "${GNAME}:x:${GID}:${UNAME}" \
>> /etc/group \
&& mkdir -p "${UHOME}"
# Spacemacs
COPY .spacemacs ${UHOME}/.spacemacs
RUN apk --no-cache add git \
&& git clone https://github.com/syl20bnr/spacemacs.git -b develop \
"${UHOME}/.emacs.d" \
&& chown "${UID}":"${GID}" -R "${UHOME}" \
&& su-exec ${UNAME} emacs -nw -batch -u ${UNAME} -q -kill \
# 2X
&& su-exec ${UNAME} emacs -nw -batch -u ${UNAME} -q -kill \
&& cleanup
# Xpra deps
RUN apk --no-cache add \
cython \
dbus-x11 \
desktop-file-utils \
ffmpeg \
gst-plugins-base1 \
gst-plugins-good1 \
gstreamer1 \
libvpx \
libxcomposite \
libxdamage \
libxext \
libxfixes \
libxkbfile \
libxrandr \
libxtst \
musl-utils \
py-asn1 \
py-cffi \
py-cryptography \
py-enum34 \
py-gobject3 \
py-gtk \
py-gtkglext \
py-idna \
py-ipaddress \
py-lz4 \
py-numpy \
py-pillow \
py-rencode \
py-six \
shared-mime-info \
xf86-video-dummy \
xorg-server \
xset \
# Meta build-deps
&& apk --no-cache add --virtual build-deps \
build-base \
cython-dev \
ffmpeg-dev \
flac-dev \
git \
git-svn \
libc-dev \
libvpx-dev \
libxcomposite-dev \
libxdamage-dev \
libxext-dev \
libxfixes-dev \
libxkbfile-dev \
libxrandr-dev \
libxtst-dev \
linux-headers \
opus-dev \
perl-git \
py-gtk-dev \
py-gtkglext-dev \
py-numpy-dev \
py2-pip \
python-dev \
which \
xvidcore-dev \
# PIP
&& pip install \
pycrypto \
netifaces \
websockify \
xxhash \
# Xpra
&& cd /tmp/ \
&& git svn clone -s -r${XPRA_REV} https://www.xpra.org/svn/Xpra/ \
&& cd /tmp/Xpra/src \
&& echo -e 'Section "Module"\n Load "fb"\n EndSection' \
>> etc/xpra/xorg.conf \
&& python2 setup.py install \
--verbose \
--with-Xdummy \
--with-Xdummy_wrapper \
--with-bencode \
--with-clipboard \
--with-csc_swscale \
--with-cython_bencode \
--with-enc_ffmpeg \
--with-gtk2 \
--with-gtk_x11 \
--with-pillow \
--with-server \
--with-vpx \
--with-vsock \
--with-x11 \
--without-client \
--without-clipboard \
--without-csc_libyuv \
--without-dbus \
--without-dec_avcodec2 \
--without-enc_x264 \
--without-enc_x265 \
--without-gtk3 \
--without-mdns \
--without-opengl \
--without-printing \
--without-proxy \
--without-sound \
--without-shadow \
--without-webcam \
&& mkdir -p /var/run/xpra/ \
&& cd ../.. \
&& rm -fr xpra-$XPRA_VERSION \
# Cleanup
&& apk del build-deps \
&& cleanup
COPY xorg.conf /etc/xpra/xorg.conf
RUN chmod 604 /etc/xpra/xorg.conf \
&& chown root:root /etc/xpra/xorg.conf
COPY /sbin/run /usr/local/sbin/run
COPY /sbin/healthcheck /usr/local/sbin/healthcheck
ENV DISPLAY=":14" \
XORG_DPI="96" \
XPRA_COMPRESS="0" \
XPRA_DPI="0" \
XPRA_ENCODING="rgb" \
XPRA_HTML_DPI="96" \
XPRA_KEYBOARD_SYNC="yes" \
XPRA_IDLE_TIMEOUT="60" \
XPRA_SERVER_IDLE_TIMEOUT="3600" \
XPRA_TCP_PORT="10000"
ENV APPROXIMATE_MAX_CONNECTION_LENGTH_S="120"
EXPOSE ${XPRA_TCP_PORT}
ENV TMPDIR="${UHOME}/.emacs.d/.cache"
ENV XAUTHORITY="${TMPDIR}/Xauthority"
ENV NO_AT_BRIDGE=1
# Mount point for tmpfs
RUN rm -rf /tmp \
&& ln -s "${TMPDIR}" /tmp \
&& ln -s "${TMPDIR}" ${UHOME}/.xpra \
&& mkdir -p "${TMPDIR}/workspace"
HEALTHCHECK --interval=30s \
--timeout=30s \
--retries=4 \
CMD /usr/local/sbin/healthcheck
CMD run