forked from acceleratescience/runpod_data_test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart_cli.sh
More file actions
37 lines (32 loc) · 1.04 KB
/
start_cli.sh
File metadata and controls
37 lines (32 loc) · 1.04 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
#!/bin/bash
set -e
if command -v apt-get >/dev/null 2>&1; then
echo "Detected apt-based system (Ubuntu/Debian)."
apt-get update -y
apt-get install -y --no-install-recommends \
git build-essential cmake libjson-c-dev libwebsockets-dev ca-certificates
rm -rf /var/lib/apt/lists/*
elif command -v apk >/dev/null 2>&1; then
echo "Detected apk-based system (Alpine)."
apk update
apk add --no-cache \
git build-base cmake json-c-dev libwebsockets-dev ca-certificates
else
echo "Unsupported package manager. Please use Ubuntu or Alpine base image."
exit 1
fi
if [ ! -f /usr/local/bin/ttyd ]; then
git clone https://github.com/tsl0922/ttyd.git /tmp/ttyd-src
cd /tmp/ttyd-src
mkdir build && cd build
cmake ..
make -j"$(nproc)"
cp ttyd /usr/local/bin/ttyd
cd /
rm -rf /tmp/ttyd-src
fi
mkdir -p /workspace/workshop
cd /workspace/workshop
nohup script -q -c "/usr/local/bin/ttyd -p 8880 bash" /dev/null >/tmp/cli.log 2>&1 &
echo "Command-line interface started on port 8880 (interactive)."
echo "Logs: /tmp/cli.log"