Skip to content

Commit 014c8fa

Browse files
authored
Bullseye alongside Bookworm (demodesk#61)
* revert to bullseye. * add bookworm. * add bookworm to variants. * include xf86-video-dummy because the remote git instance is offline. * fix configure.
1 parent 3dbcc41 commit 014c8fa

34 files changed

+54168
-30
lines changed

.devcontainer/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5858
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
5959
&& apt-get -y install --no-install-recommends \
6060
wget ca-certificates supervisor \
61-
pulseaudio xserver-xorg-video-dummy \
61+
pulseaudio dbus-x11 xserver-xorg-video-dummy \
6262
libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 \
6363
#
6464
# needed for profile upload preStop hook
@@ -122,6 +122,7 @@ COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/
122122
COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so
123123

124124
# copy runtime files
125+
COPY runtime/dbus /usr/bin/dbus
125126
COPY runtime/default.pa /etc/pulse/default.pa
126127
COPY runtime/supervisord.conf /etc/neko/supervisord.conf
127128
COPY runtime/xorg.conf /etc/neko/xorg.conf
@@ -132,7 +133,8 @@ COPY dev/runtime/config.yml /etc/neko/neko.yml
132133
COPY dev/runtime/supervisord.conf /etc/neko/supervisord/dev.conf
133134

134135
# customized scripts
135-
RUN echo '#!/bin/sh\nsleep infinity' > /usr/bin/neko; \
136+
RUN chmod +x /usr/bin/dbus;\
137+
echo '#!/bin/sh\nsleep infinity' > /usr/bin/neko; \
136138
chmod +x /usr/bin/neko; \
137139
echo '#!/bin/sh\nsudo sh -c "export USER='$USERNAME'\nexport HOME=/home/'$USERNAME'\n/usr/bin/supervisord -c /etc/neko/supervisord.conf"' > /usr/bin/deps; \
138140
chmod +x /usr/bin/deps; \

.github/workflows/build_variants.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ jobs:
1919
strategy:
2020
matrix:
2121
include:
22+
- variant: bookworm
23+
dockerfile: Dockerfile.bookworm
2224
- variant: nvidia
25+
dockerfile: Dockerfile.nvidia
26+
- variant: nvidia_bookworm
27+
dockerfile: Dockerfile.nvidia.bookworm
2328

2429
steps:
2530
- name: Checkout repository
@@ -42,7 +47,7 @@ jobs:
4247
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
4348
with:
4449
context: .
45-
file: Dockerfile.${{ matrix.variant }}
50+
file: ${{ matrix.dockerfile }}
4651
push: true
4752
tags: ${{ steps.meta.outputs.tags }}
4853
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

+24-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
ARG BASE_IMAGE=debian:bullseye-slim
2+
ARG BUILD_IMAGE=golang:1.21-bullseye
3+
14
#
25
# Stage 0: Build xorg dependencies.
36
#
4-
FROM debian:bookworm-slim as xorg-deps
7+
FROM $BASE_IMAGE as xorg-deps
58

69
ENV DEBIAN_FRONTEND=noninteractive
710

@@ -15,13 +18,12 @@ WORKDIR /xorg
1518

1619
COPY xorg/ /xorg/
1720

18-
# build xserver-xorg-video-dummy 0.3.8-2 with RandR support.
21+
# build xf86-video-dummy v0.3.8 with RandR support
1922
RUN set -eux; \
20-
cd xf86-video-dummy; \
21-
git clone --depth 1 --branch xserver-xorg-video-dummy-1_0.3.8-2 https://salsa.debian.org/xorg-team/driver/xserver-xorg-video-dummy; \
22-
cd xserver-xorg-video-dummy; \
23-
patch -p1 < ../xdummy-randr.patch; \
24-
./autogen.sh; \
23+
cd xf86-video-dummy/v0.3.8; \
24+
patch -p1 < ../01_v0.3.8_xdummy-randr.patch; \
25+
autoreconf -v --install; \
26+
./configure; \
2527
make -j$(nproc); \
2628
make install;
2729

@@ -36,7 +38,7 @@ RUN set -eux; \
3638
#
3739
# Stage 1: Build.
3840
#
39-
FROM golang:1.21-bookworm as build
41+
FROM $BUILD_IMAGE as build
4042
WORKDIR /src
4143

4244
#
@@ -45,8 +47,12 @@ ENV DEBIAN_FRONTEND=noninteractive
4547
RUN set -eux; \
4648
apt-get update; \
4749
apt-get install -y --no-install-recommends \
48-
libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev libxcvt-dev \
50+
libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev \
4951
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \
52+
# install libxcvt-dev (not available in debian:bullseye)
53+
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt-dev_0.1.2-1_amd64.deb; \
54+
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \
55+
apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb ./libxcvt-dev_0.1.2-1_amd64.deb; \
5056
#
5157
# clean up
5258
apt-get clean -y; \
@@ -64,7 +70,7 @@ RUN ./build
6470
#
6571
# Stage 2: Runtime.
6672
#
67-
FROM debian:bookworm-slim as runtime
73+
FROM $BASE_IMAGE as runtime
6874

6975
#
7076
# set custom user
@@ -79,8 +85,8 @@ RUN set -eux; \
7985
apt-get update; \
8086
apt-get install -y --no-install-recommends \
8187
wget ca-certificates supervisor \
82-
pulseaudio xserver-xorg-video-dummy \
83-
libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx7 libxcvt0 \
88+
pulseaudio dbus-x11 xserver-xorg-video-dummy \
89+
libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx6 \
8490
#
8591
# needed for profile upload preStop hook
8692
zip curl \
@@ -92,6 +98,10 @@ RUN set -eux; \
9298
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
9399
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
94100
gstreamer1.0-pulseaudio; \
101+
# install libxcvt0 (not available in debian:bullseye)
102+
wget http://ftp.de.debian.org/debian/pool/main/libx/libxcvt/libxcvt0_0.1.2-1_amd64.deb; \
103+
apt-get install --no-install-recommends ./libxcvt0_0.1.2-1_amd64.deb; \
104+
rm ./libxcvt0_0.1.2-1_amd64.deb; \
95105
#
96106
# create a non-root user
97107
groupadd --gid $USER_GID $USERNAME; \
@@ -133,8 +143,10 @@ COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xor
133143
#
134144
# copy runtime configs
135145
COPY --chown=neko:neko runtime/.Xresources /home/$USERNAME/.Xresources
146+
COPY runtime/dbus /usr/bin/dbus
136147
COPY runtime/default.pa /etc/pulse/default.pa
137148
COPY runtime/supervisord.conf /etc/neko/supervisord.conf
149+
COPY runtime/supervisord.dbus.conf /etc/neko/supervisord.dbus.conf
138150
COPY runtime/xorg.conf /etc/neko/xorg.conf
139151

140152
#

Dockerfile.bookworm

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
ARG BASE_IMAGE=debian:bookworm-slim
2+
ARG BUILD_IMAGE=golang:1.21-bookworm
3+
4+
#
5+
# Stage 0: Build xorg dependencies.
6+
#
7+
FROM $BASE_IMAGE as xorg-deps
8+
9+
ENV DEBIAN_FRONTEND=noninteractive
10+
11+
RUN set -eux; \
12+
apt-get update; \
13+
apt-get install -y \
14+
git gcc pkgconf autoconf automake libtool make xorg-dev xutils-dev \
15+
&& rm -rf /var/lib/apt/lists/*;
16+
17+
WORKDIR /xorg
18+
19+
COPY xorg/ /xorg/
20+
21+
# build xf86-video-dummy v0.3.8 with RandR support
22+
RUN set -eux; \
23+
cd xf86-video-dummy/v0.3.8; \
24+
patch -p1 < ../01_v0.3.8_xdummy-randr.patch; \
25+
autoreconf -v --install; \
26+
./configure; \
27+
make -j$(nproc); \
28+
make install;
29+
30+
# build custom input driver
31+
RUN set -eux; \
32+
cd xf86-input-neko; \
33+
./autogen.sh --prefix=/usr; \
34+
./configure; \
35+
make -j$(nproc); \
36+
make install;
37+
38+
#
39+
# Stage 1: Build.
40+
#
41+
FROM $BUILD_IMAGE as build
42+
WORKDIR /src
43+
44+
#
45+
# install dependencies
46+
ENV DEBIAN_FRONTEND=noninteractive
47+
RUN set -eux; \
48+
apt-get update; \
49+
apt-get install -y --no-install-recommends \
50+
libx11-dev libxrandr-dev libxtst-dev libgtk-3-dev libxcvt-dev \
51+
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev; \
52+
#
53+
# clean up
54+
apt-get clean -y; \
55+
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
56+
57+
ARG GIT_COMMIT
58+
ARG GIT_BRANCH
59+
ARG GIT_TAG
60+
61+
#
62+
# build server
63+
COPY . .
64+
RUN ./build
65+
66+
#
67+
# Stage 2: Runtime.
68+
#
69+
FROM $BASE_IMAGE as runtime
70+
71+
#
72+
# set custom user
73+
ARG USERNAME=neko
74+
ARG USER_UID=1000
75+
ARG USER_GID=$USER_UID
76+
77+
#
78+
# install dependencies
79+
ENV DEBIAN_FRONTEND=noninteractive
80+
RUN set -eux; \
81+
apt-get update; \
82+
apt-get install -y --no-install-recommends \
83+
wget ca-certificates supervisor \
84+
pulseaudio xserver-xorg-video-dummy \
85+
libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx7 libxcvt0 \
86+
#
87+
# needed for profile upload preStop hook
88+
zip curl \
89+
#
90+
# file chooser handler, clipboard, drop
91+
xdotool xclip libgtk-3-0 \
92+
#
93+
# gst
94+
gstreamer1.0-plugins-base gstreamer1.0-plugins-good \
95+
gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \
96+
gstreamer1.0-pulseaudio; \
97+
#
98+
# create a non-root user
99+
groupadd --gid $USER_GID $USERNAME; \
100+
useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \
101+
adduser $USERNAME audio; \
102+
adduser $USERNAME video; \
103+
adduser $USERNAME pulse; \
104+
#
105+
# workaround for an X11 problem: http://blog.tigerteufel.de/?p=476
106+
mkdir /tmp/.X11-unix; \
107+
chmod 1777 /tmp/.X11-unix; \
108+
chown $USERNAME /tmp/.X11-unix/; \
109+
#
110+
# make directories for neko
111+
mkdir -p /etc/neko /var/www; \
112+
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
113+
#
114+
# install fonts
115+
apt-get install -y --no-install-recommends \
116+
# Emojis
117+
fonts-noto-color-emoji \
118+
# Chinese fonts
119+
fonts-arphic-ukai fonts-arphic-uming \
120+
# Japanese fonts
121+
fonts-ipafont-mincho fonts-ipafont-gothic \
122+
# Korean fonts
123+
fonts-unfonts-core \
124+
# Indian fonts
125+
fonts-indic; \
126+
#
127+
# clean up
128+
apt-get clean -y; \
129+
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
130+
131+
# copy dependencies from previous stage
132+
COPY --from=xorg-deps /usr/local/lib/xorg/modules/drivers/dummy_drv.so /usr/lib/xorg/modules/drivers/dummy_drv.so
133+
COPY --from=xorg-deps /usr/local/lib/xorg/modules/input/neko_drv.so /usr/lib/xorg/modules/input/neko_drv.so
134+
135+
#
136+
# copy runtime configs
137+
COPY --chown=neko:neko runtime/.Xresources /home/$USERNAME/.Xresources
138+
COPY runtime/default.pa /etc/pulse/default.pa
139+
COPY runtime/supervisord.conf /etc/neko/supervisord.conf
140+
COPY runtime/xorg.conf /etc/neko/xorg.conf
141+
142+
#
143+
# copy runtime folders
144+
COPY --chown=neko:neko runtime/icon-theme /home/$USERNAME/.icons/default
145+
COPY runtime/fontconfig/* /etc/fonts/conf.d/
146+
COPY runtime/fonts /usr/local/share/fonts
147+
148+
#
149+
# set default envs
150+
ENV USER=$USERNAME
151+
ENV DISPLAY=:99.0
152+
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
153+
ENV NEKO_SERVER_BIND=:8080
154+
ENV NEKO_PLUGINS_ENABLED=true
155+
ENV NEKO_PLUGINS_DIR=/etc/neko/plugins/
156+
157+
#
158+
# copy plugins from previous stage
159+
COPY --from=build /src/bin/plugins/ $NEKO_PLUGINS_DIR
160+
161+
#
162+
# copy executable from previous stage
163+
COPY --from=build /src/bin/neko /usr/bin/neko
164+
165+
#
166+
# add healthcheck
167+
HEALTHCHECK --interval=10s --timeout=5s --retries=8 \
168+
CMD wget -O - http://localhost:${NEKO_SERVER_BIND#*:}/health || exit 1
169+
170+
#
171+
# run neko
172+
CMD ["/usr/bin/supervisord", "-s", "-c", "/etc/neko/supervisord.conf"]

0 commit comments

Comments
 (0)