Repository navigation
Expand file tree
/
Copy pathContainerfile
More file actions
327 lines (282 loc) · 8.71 KB
/
Copy pathContainerfile
File metadata and controls
327 lines (282 loc) · 8.71 KB
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
ARG FEDORA_VERSION=45
ARG PULSEAUDIO_MODULE_XRDP_VERSION=0.8
ARG PULSEAUDIO_VERSION=17.0
ARG S6_OVERLAY_VERSION=3.2.3.2
ARG XORGXRDP_VERSION=0.10.5
ARG XRDP_VERSION=0.10.6
ARG XORG_SERVER_VERSION=21.1.26
FROM ghcr.io/nedix/fedora-base-container:${FEDORA_VERSION} AS base
ARG BUILD_DEPENDENCIES=" \
tar \
xz \
"
ARG S6_OVERLAY_VERSION
RUN dnf makecache --refresh \
&& dnf install -y $BUILD_DEPENDENCIES \
&& case "$(uname -m)" in \
aarch64) \
S6_OVERLAY_ARCHITECTURE="aarch64" \
;; arm*) \
S6_OVERLAY_ARCHITECTURE="arm" \
;; x86_64) \
S6_OVERLAY_ARCHITECTURE="x86_64" \
;; *) echo "Unsupported architecture: $(uname -m)"; exit 1; ;; \
esac \
&& curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz" \
| tar -xpJf- -C / \
&& curl -fsSL "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCHITECTURE}.tar.xz" \
| tar -xpJf- -C / \
&& dnf remove -y $BUILD_DEPENDENCIES
FROM base AS build-base
RUN dnf install -y \
automake \
bison \
cmake \
cpio \
doxygen \
flex \
g++ \
gawk \
gcc \
git \
gzip \
intltool \
kernel-headers \
koji \
libtool \
m4 \
make \
meson \
pkgconfig \
rpm2cpio \
samurai \
tar \
xmltoman
FROM build-base AS xorg-server
RUN dnf install -y \
libXfont2-devel \
libXi-devel \
libXinerama-devel \
libXres-devel \
libXv-devel \
libdrm-devel \
libepoxy-devel \
libgudev-devel \
libxcvt-devel \
libxkbfile-devel \
libxshmfence-devel \
mesa-libEGL-devel \
mesa-libGL-devel \
mesa-libgbm-devel \
openssl-devel \
pixman-devel \
systemtap-sdt-devel \
xorg-x11-util-macros \
xorg-x11-xtrans-devel
WORKDIR /build/xorg-server
ARG XORG_SERVER_VERSION
RUN curl -fsSL "https://gitlab.freedesktop.org/xorg/xserver/-/archive/xorg-server-${XORG_SERVER_VERSION}/xserver-xorg-server-${XORG_SERVER_VERSION}.tar.gz" \
| tar -xpzf- --strip-components=1 \
&& export CFLAGS="-O2 -g1" CPPFLAGS="-O2 -g1" CXXFLAGS="-O2 -g1" \
&& meson setup build \
--prefix=/usr \
-Db_lto=true \
-Db_ndebug=true \
-Ddefault_font_path="catalogue:/etc/X11/fontpath.d,built-ins" \
-Ddpms=true \
-Ddri1=false \
-Ddri2=true \
-Ddri3=true \
-Dfallback_input_driver=libinput \
-Dglamor=true \
-Dglx=true \
-Dhal=false \
-Dipv6=true \
-Dlisten_local=true \
-Dlisten_tcp=false \
-Dlisten_unix=true \
-Dmodule_dir=/usr/lib64/xorg/modules \
-Dpciaccess=true \
-Dsecure-rpc=false \
-Dsuid_wrapper=true \
-Dsystemd_logind=false \
-Dudev=true \
-Dxcsecurity=true \
-Dxdm-auth-1=true \
-Dxdmcp=false \
-Dxephyr=false \
-Dxkb_dir=/usr/share/X11/xkb \
-Dxkb_output_dir=/var/lib/xkb \
-Dxnest=false \
-Dxorg=true \
-Dxvfb=true \
-Dxwin=false \
&& DESTDIR="${PWD}/output" ninja -C build install
FROM build-base AS xrdp
RUN dnf install -y \
lame-devel \
libX11-devel \
libXfixes-devel \
libXrandr-devel \
libdrm-devel \
libepoxy-devel \
libxkbfile-devel \
nasm \
openssl-devel \
pam \
pam-devel \
pixman-devel \
turbojpeg-devel \
yasm-devel
COPY --link --from=xorg-server /build/xorg-server/output/ /
WORKDIR /build/xrdp
ARG XRDP_VERSION
RUN git init "$PWD" \
&& git remote add origin https://github.com/neutrinolabs/xrdp.git \
&& git fetch origin \
&& git checkout -b main "v${XRDP_VERSION}" \
&& git submodule update --init --recursive --depth=1 \
&& sed -E \
-e "s|#define MIN_MS_BETWEEN_FRAMES 40|#define MIN_MS_BETWEEN_FRAMES 10|" \
-i /build/xrdp/xrdp/xrdp_mm.c
RUN export CFLAGS="-O2 -g1" CPPFLAGS="-O2 -g1" CXXFLAGS="-O2 -g1" \
&& ./bootstrap \
&& ./configure \
--localstatedir=/var \
--prefix=/usr \
--sbindir=/usr/bin \
--sysconfdir=/etc \
--enable-glamor \
--enable-ipv6 \
--enable-mp3lame \
--enable-pam \
--enable-pixman \
--enable-rfxcodec \
--enable-tjpeg \
--enable-vsock \
&& make -j $(( $(nproc) + 1 )) \
&& make DESTDIR="${PWD}/output" install
FROM build-base AS xorgxrdp
RUN dnf install -y \
libdrm-devel \
libepoxy-devel \
mesa-libgbm-devel \
nasm \
xorg-x11-server-devel \
yasm-devel
COPY --link --from=xorg-server /build/xorg-server/output/ /
COPY --link --from=xrdp /build/xrdp/output/ /
WORKDIR /build/xorgxrdp
ARG XORGXRDP_VERSION
RUN curl -fsSL "https://github.com/neutrinolabs/xorgxrdp/tarball/v${XORGXRDP_VERSION}" \
| tar -xpzf- --strip-components=1 \
&& sed -E \
-e "s|#define MIN_MS_BETWEEN_FRAMES 40|#define MIN_MS_BETWEEN_FRAMES 10|" \
-i /build/xorgxrdp/module/rdpClientCon.c \
&& sed -E \
-e "s|const int vfreq = 50;|const int vfreq = 60;|" \
-i /build/xorgxrdp/module/rdpRandR.c \
&& export CFLAGS="-O2 -g1 $(pkg-config --cflags libdrm)" CPPFLAGS="-O2 -g1" CXXFLAGS="-O2 -g1" \
&& ./bootstrap \
&& ./configure \
--libdir=/usr/lib64/xorg/modules \
--localstatedir=/var \
--mandir=/usr/share/man \
--prefix=/usr \
--sysconfdir=/etc \
--enable-glamor \
&& make -j $(( $(nproc) + 1 )) \
&& make DESTDIR="${PWD}/output" install \
&& sed -E \
-e "s|^(Section \"Module\")$|\1\n Load \"glamoregl\"|" \
-i /build/xorgxrdp/output/etc/X11/xrdp/xorg.conf
FROM build-base AS pulseaudio
RUN dnf install -y \
avahi-devel \
check-devel \
dbus-devel \
glib2-devel \
libICE-devel \
libSM-devel \
libX11-devel \
libXi-devel \
libXt-devel \
libXtst-devel \
libasyncns-devel \
libatomic_ops-devel \
libatomic_ops-static \
libcap-devel \
libsndfile-devel \
libtdb-devel \
libtool-ltdl-devel \
openssl-devel \
orc-devel \
sbc-devel \
xcb-util-devel \
xorg-x11-proto-devel
WORKDIR /build/pulseaudio
ARG PULSEAUDIO_VERSION
RUN curl -fsSL "https://github.com/pulseaudio/pulseaudio/tarball/v${PULSEAUDIO_VERSION}" \
| gunzip \
| tar -xvf- --strip-components=1 \
&& export CFLAGS="-O2 -g1" CPPFLAGS="-O2 -g1" CXXFLAGS="-O2 -g1" \
&& meson rewrite kwargs set project / version "$PULSEAUDIO_VERSION" \
&& meson setup build \
--prefix=/usr \
-Db_lto=true \
-Db_ndebug=true \
&& DESTDIR="${PWD}/output" ninja -C build install
FROM build-base AS pulseaudio-module-xrdp
RUN dnf install -y \
libtool-ltdl-devel
COPY --link --from=pulseaudio /build/pulseaudio/ /build/pulseaudio/
COPY --link --from=pulseaudio /build/pulseaudio/output/ /
COPY --link --from=xrdp /build/xrdp/output/ /
WORKDIR /build/pulseaudio-module-xrdp
ARG PULSEAUDIO_MODULE_XRDP_VERSION
RUN curl -fsSL "https://github.com/neutrinolabs/pulseaudio-module-xrdp/tarball/v${PULSEAUDIO_MODULE_XRDP_VERSION}" \
| tar -xpzf- --strip-components=1 \
&& export CFLAGS="-O2 -g1" CXXFLAGS="-O2 -g1" CPPFLAGS="-O2 -g1" \
&& ./bootstrap \
&& ./configure \
PULSE_DIR=/build/pulseaudio \
--libdir=/usr/lib64/xorg/modules \
--localstatedir=/var \
--mandir=/usr/share/man \
--prefix=/usr \
--sysconfdir=/etc \
&& make -j $(( $(nproc) + 1 )) \
&& make DESTDIR="${PWD}/output" install
FROM base
RUN dnf install -y \
dbus-daemon \
dbus-x11 \
libXfont2 \
libepoxy \
libxcvt \
openssl \
orc \
pixman \
seatd \
turbojpeg \
xkbcomp \
xorg-x11-xauth \
xset \
xxd
RUN dnf install -y kodi kodi-inputstream-adaptive
RUN dnf install -y x264-libs x265-libs
RUN dnf install -y mkpasswd sudo
COPY --from=xorg-server /build/xorg-server/output/ /
COPY --from=xrdp /build/xrdp/output/ /
COPY --from=xorgxrdp /build/xorgxrdp/output/ /
COPY --from=pulseaudio /build/pulseaudio/output/ /
COPY --from=pulseaudio-module-xrdp /build/pulseaudio-module-xrdp/output/ /
COPY /rootfs/ /
RUN dnf clean all \
&& ldconfig
ENV NVIDIA_DRIVER_CAPABILITIES=compute,graphics,utility,video,display
ENTRYPOINT ["/entrypoint.sh"]
# RDP
EXPOSE 3389
VOLUME /var/kodi-rdp/.kodi/
VOLUME /var/xrdp/certs/