-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.neko
160 lines (141 loc) · 4.83 KB
/
Dockerfile.neko
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
#####
FROM darkness4/katago:latest as server
#####
WORKDIR /src
#
# install dependencies
RUN set -eux; apt update -y; \
apt install -y --no-install-recommends curl build-essential git cmake make libx11-dev libxrandr-dev libxtst-dev \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly; \
# install golang
curl -fsSL https://go.dev/dl/go1.21.5.linux-amd64.tar.gz -o go1.21.5.linux-amd64.tar.gz \
&& tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz \
&& rm -f go1.21.5.linux-amd64.tar.gz; \
#
# install libclipboard
set -eux; \
cd /tmp; \
git clone --depth=1 https://github.com/jtanx/libclipboard; \
cd libclipboard; \
cmake .; \
make -j4; \
make install; \
rm -rf /tmp/libclipboard; \
#
# clean up
apt clean -y; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
ENV PATH=${PATH}:/usr/local/go/bin
RUN git clone https://github.com/m1k1o/neko.git \
&& cd ./neko/server \
&& ./build
# ------------------
FROM darkness4/katago:latest as runtime
# ------------------
ARG USERNAME=neko
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN set -eux; \
apt update -y; \
#
# install dependencies
apt install -y --no-install-recommends wget ca-certificates supervisor git curl; \
apt install -y --no-install-recommends pulseaudio dbus-x11 xserver-xorg-video-dummy; \
apt install -y --no-install-recommends libcairo2 libxcb1 libxrandr2 libxv1 libopus0 libvpx7; \
#
# gst
apt install -y --no-install-recommends libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-pulseaudio; \
#
# install fonts
apt install -y --no-install-recommends \
# Google emojis
fonts-noto-color-emoji \
# Japanese fonts
fonts-takao-mincho \
# Chinese fonts
fonts-wqy-zenhei xfonts-intl-chinese xfonts-wqy \
# Korean fonts
fonts-wqy-microhei; \
#
# create a non-root user
groupadd --gid $USER_GID $USERNAME; \
useradd --uid $USER_UID --gid $USERNAME --shell /bin/bash --create-home $USERNAME; \
adduser $USERNAME audio; \
adduser $USERNAME video; \
adduser $USERNAME pulse; \
#
# workaround for an X11 problem: http://blog.tigerteufel.de/?p=476
mkdir /tmp/.X11-unix; \
chmod 1777 /tmp/.X11-unix; \
chown $USERNAME /tmp/.X11-unix/; \
#
# make directories for neko
mkdir -p /etc/neko /var/www /var/log/neko \
/tmp/runtime-$USERNAME \
/home/$USERNAME/.config/pulse \
/home/$USERNAME/.local/share/xorg; \
chmod 1777 /var/log/neko; \
chown $USERNAME /var/log/neko/ /tmp/runtime-$USERNAME; \
chown -R $USERNAME:$USERNAME /home/$USERNAME; \
#
# clean up
apt clean -y; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
# copy config files
RUN git clone https://github.com/m1k1o/neko.git \
&& cp neko/.docker/base/dbus /usr/bin/dbus \
&& cp neko/.docker/base/default.pa /etc/pulse/default.pa \
&& cp neko/.docker/base/supervisord.conf /etc/neko/supervisord.conf \
&& cp neko/.docker/base/xorg.conf /etc/neko/xorg.conf \
&& rm -rf neko/
ENV USER=$USERNAME
ENV DISPLAY=:99.0
ENV PULSE_SERVER=unix:/tmp/pulseaudio.socket
ENV XDG_RUNTIME_DIR=/tmp/runtime-$USERNAME
ENV NEKO_PASSWORD=neko
ENV NEKO_PASSWORD_ADMIN=admin
ENV NEKO_BIND=:8080
COPY --from=server /src/neko/server/bin/neko /usr/bin/neko
COPY --from=m1k1o/neko:latest /var/www/ /var/www
#
# run neko
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/neko/supervisord.conf"]
# ------------------
FROM darkness4/katago:latest as sabaki
# ------------------
WORKDIR /src
RUN set -eux; apt update -y; \
apt install -y git ca-certificates curl gnupg; \
#
mkdir -p /etc/apt/keyrings; \
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg; \
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list; \
#
apt update -y; \
apt install nodejs -y; \
#
apt clean -y; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
RUN git clone https://github.com/SabakiHQ/Sabaki \
&& cd Sabaki \
&& npm i \
&& npm run dist:linux
# ------------------
FROM runtime
# ------------------
COPY --from=sabaki /src/Sabaki/dist/sabaki-v0.52.2-linux-x64.AppImage /usr/bin/sabaki
RUN set -eux; apt update -y; \
apt install -y --no-install-recommends openbox libatk1.0-0 libatk-bridge2.0-0 libgtk-3-0; \
#
mkdir -p /home/neko/.config/Sabaki; \
chown -R neko /home/neko/.config; \
#
apt clean -y; \
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
#
# copy configuation files
COPY neko/supervisord.conf /etc/neko/supervisord/sabaki.conf
COPY neko/openbox.xml /etc/neko/openbox.xml
COPY --chown=neko neko/settings.json /home/neko/.config/Sabaki/settings.json
COPY neko/default_gtp.cfg /app/default_gtp.cfg