-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (42 loc) · 1.79 KB
/
Dockerfile
File metadata and controls
48 lines (42 loc) · 1.79 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
FROM debian
SHELL ["/bin/bash", "-c"]
WORKDIR /app
EXPOSE 8025
EXPOSE 2519
COPY entrypoint.sh /app/
COPY init.sh /
VOLUME /data
RUN apt update \
&& apt install curl python3 python3-pip python3-venv nano unzip pipx -y \
&& mkdir -p /app/agent \
&& mkdir -p /app/dashboard \
&& pipx install nb-cli \
&& pipx ensurepath \
&& source ~/.bashrc \
&& cd /app/agent \
&& ARCH=$(uname -m) \
&& if [ "$ARCH" = "x86_64" ]; then \
ARCH="amd64"; \
elif [ "$ARCH" = "aarch64" ]; then \
ARCH="arm64"; \
else \
echo "Unsupported architecture"; \
exit 1; \
fi \
&& DOWN=$(curl https://api.github.com/repos/NonebotGUI/nonebot-agent/releases/latest | grep "browser_download_url" | grep linux | grep $ARCH | cut -d '"' -f 4) \
&& curl -OL $DOWN \
&& chmod 777 agent-linux-$ARCH \
&& timeout -s SIGKILL 6s ./agent-linux-$ARCH || true \
&& sed -i 's/"nbcli":"default"/"nbcli":"\/root\/.local\/bin\/nb"/g' config.json \
&& cd /app/dashboard \
&& DOWN_MAIN=$(curl https://api.github.com/repos/NonebotGUI/nonebot-flutter-webui-dashboard/releases/latest | grep "browser_download_url" | grep linux | grep $ARCH | cut -d '"' -f 4) \
&& DOWN_WEB=$(curl https://api.github.com/repos/NonebotGUI/nonebot-flutter-webui-dashboard/releases/latest | grep "browser_download_url" | grep canvaskit | cut -d '"' -f 4) \
&& curl -OL $DOWN_MAIN \
&& curl -OL $DOWN_WEB \
&& unzip dashboard-index-canvaskit.zip \
&& chmod 777 dashboard-linux-$ARCH \
&& rm dashboard-index-canvaskit.zip \
&& pip config set global.index-url https://mirrors.ustc.edu.cn/pypi/simple \
&& timeout -s SIGKILL 3s ./dashboard-linux-$ARCH || true \
&& sed -i 's/"connectionMode": 1/"connectionMode": 2/g' config.json
ENTRYPOINT ["sh", "/init.sh"]