-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
161 lines (141 loc) · 5.65 KB
/
Copy pathDockerfile
File metadata and controls
161 lines (141 loc) · 5.65 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
# syntax=docker/dockerfile:1
# ucs-detect terminal testing image
# Arch Linux rolling release for latest terminal packages (libvte, foot, ghostty, etc.)
FROM archlinux:latest
ENV LANG=en_US.UTF-8
ENV LC_ALL=en_US.UTF-8
ENV PYTHONDONTWRITEBYTECODE=1
# bootstrap: update mirrors, install base deps, generate locale
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -Syu --noconfirm --needed \
base-devel git sudo curl wget ccache \
python python-pip dbus \
&& pacman -Scc --noconfirm \
&& echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen
# install X11, openbox, window manager, and terminal emulator packages
# X11 virtual framebuffer and automation tools
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm --needed \
xorg-server-xvfb \
xdotool \
xorg-xwd \
xorg-xprop \
xorg-xwininfo \
openbox \
imagemagick \
weston \
fontconfig \
xorg-fonts-misc \
&& pacman -Scc --noconfirm
# unifont for consistent terminal font rendering
# (not in Arch official repos, only AUR; download OTF directly from GNU)
RUN mkdir -p /usr/share/fonts/OTF && \
curl -L --retry 3 --retry-delay 5 --retry-max-time 60 \
-o /usr/share/fonts/OTF/unifont.otf \
"https://unifoundry.com/pub/unifont/unifont-16.0.02/font-builds/unifont-16.0.02.otf" && \
fc-cache -fv
# create non-root user for AUR builds and running tests
RUN useradd -m -s /bin/bash -u 1000 ucs && \
echo "ucs ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
mkdir -p /home/ucs/.ccache && chown -R ucs:ucs /home/ucs/.ccache
# install yay (AUR helper) as ucs user, then install AUR-only terminals
RUN --mount=type=cache,target=/home/ucs/.ccache,uid=1000,gid=1000 \
--mount=type=cache,target=/home/ucs/.cache/yay,uid=1000,gid=1000 \
--mount=type=cache,target=/var/cache/pacman/pkg \
cd /tmp && \
sudo -u ucs git clone https://aur.archlinux.org/yay-bin.git && \
cd yay-bin && \
sudo -u ucs makepkg -si --noconfirm && \
cd / && rm -rf /tmp/yay-bin
# configure makepkg to use all CPUs minus 2, enable ccache, and tolerate old K&R-style code
RUN sed -i 's/^#\?MAKEFLAGS=.*/MAKEFLAGS="-j$(( $(nproc) > 2 ? $(nproc) - 2 : 1 ))"/' /etc/makepkg.conf && \
sed -i 's/^CFLAGS="\(.*\)"/CFLAGS="\1 -Wno-error=incompatible-pointer-types"/' /etc/makepkg.conf && \
sed -i 's/^BUILDENV=(\(.*\)!ccache\(.*\))/BUILDENV=(\1ccache\2)/' /etc/makepkg.conf && \
echo 'export CCACHE_DIR=/home/ucs/.ccache' >> /home/ucs/.bashrc && \
echo 'export PATH=/usr/lib/ccache/bin:$PATH' >> /home/ucs/.bashrc
ENV CCACHE_DIR=/home/ucs/.ccache
ENV PATH=/usr/lib/ccache/bin:$PATH
# mlterm and domterm require compiling dependencies like gtk2 from scratch, consuming
# many several hours. We do not build for them, it is too much. They ask too much.
#
#RUN --mount=type=cache,target=/home/ucs/.ccache,uid=1000,gid=1000 \
# --mount=type=cache,target=/home/ucs/.cache/yay,uid=1000,gid=1000 \
# --mount=type=cache,target=/var/cache/pacman/pkg \
# sudo -u ucs yay -S --noconfirm --needed --answerclean All --answerdiff None --removemake \
# mlterm-git \
# domterm-git \
# && pacman -Scc --noconfirm
RUN --mount=type=cache,target=/home/ucs/.ccache,uid=1000,gid=1000 \
--mount=type=cache,target=/home/ucs/.cache/yay,uid=1000,gid=1000 \
--mount=type=cache,target=/var/cache/pacman/pkg \
sudo -u ucs yay -S --noconfirm --needed --answerclean All --answerdiff None --removemake \
warp-terminal-bin \
&& pacman -Scc --noconfirm
RUN --mount=type=cache,target=/home/ucs/.ccache,uid=1000,gid=1000 \
--mount=type=cache,target=/home/ucs/.cache/yay,uid=1000,gid=1000 \
--mount=type=cache,target=/var/cache/pacman/pkg \
sudo -u ucs yay -S --noconfirm --needed --answerclean All --answerdiff None --removemake \
extraterm-bin \
bobcat-terminal \
terminator-git \
hyper-bin \
&& pacman -Scc --noconfirm
# install st (suckless terminal) from AUR
RUN --mount=type=cache,target=/home/ucs/.ccache,uid=1000,gid=1000 \
--mount=type=cache,target=/home/ucs/.cache/yay,uid=1000,gid=1000 \
--mount=type=cache,target=/var/cache/pacman/pkg \
sudo -u ucs yay -S --noconfirm --needed --answerclean All --answerdiff None --removemake st
# all terminal emulators available in Arch official repos
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm --needed \
foot \
ghostty \
kitty \
alacritty \
konsole \
xfce4-terminal \
gnome-terminal \
lxterminal \
qterminal \
rxvt-unicode \
xterm \
cool-retro-term \
terminology \
zutty \
wezterm \
contour \
rio \
tmux \
screen \
zellij \
vim \
putty \
vulkan-swrast \
xfconf \
&& pacman -Scc --noconfirm
# remove nvidia EGL vendor config -- nvidia-utils was pulled in by rio,
# but without a real GPU its libEGL_nvidia.so crashes Xvfb at startup
RUN rm -f /usr/share/glvnd/egl_vendor.d/10_nvidia.json
# python dependencies for ucs-detect
RUN --mount=type=cache,target=/var/cache/pacman/pkg \
pacman -S --noconfirm --needed \
python-yaml \
python-blessed \
python-pillow \
python-prettytable \
python-requests \
python-psutil \
python-matplotlib \
&& pacman -Scc --noconfirm
# create working directory mounted from host
WORKDIR /app
# install ucs-detect in editable mode
COPY README.rst pyproject.toml setup.cfg ./
COPY ucs_detect/ ./ucs_detect/
RUN pip install -e . --break-system-package
# entrypoint: start Xvfb if DISPLAY is set, then exec command
ENV LIBGL_ALWAYS_SOFTWARE=1
COPY docker-entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["/bin/bash"]