Unsterile
commited on
Commit
•
b4f3c4e
0
Parent(s):
Duplicate from Unsterile/onee
Browse files- .gitattributes +34 -0
- Dockerfile +153 -0
- README.md +13 -0
- npm_packages.txt +2 -0
- on_startup.sh +7 -0
- packages.txt +6 -0
- requirements.txt +1 -0
- root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-openvscode-server +0 -0
- root/etc/s6-overlay/s6-rc.d/init-openvscode-server/dependencies.d/init-config +0 -0
- root/etc/s6-overlay/s6-rc.d/init-openvscode-server/run +35 -0
- root/etc/s6-overlay/s6-rc.d/init-openvscode-server/type +1 -0
- root/etc/s6-overlay/s6-rc.d/init-openvscode-server/up +1 -0
- root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/dependencies.d/init-services +0 -0
- root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/notification-fd +1 -0
- root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/run +21 -0
- root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/type +1 -0
- root/etc/s6-overlay/s6-rc.d/user/contents.d/init-openvscode-server +0 -0
- root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-openvscode-server +0 -0
- root/usr/local/bin/install-extension +10 -0
- start_server.sh +10 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
@@ -0,0 +1,153 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM phusion/baseimage:master
|
2 |
+
|
3 |
+
ENV DEBIAN_FRONTEND=noninteractive \
|
4 |
+
TZ=Asia/Jakarta
|
5 |
+
|
6 |
+
# Remove any third-party apt sources to avoid issues with expiring keys.
|
7 |
+
# Install some basic utilities
|
8 |
+
RUN rm -f /etc/apt/sources.list.d/*.list && \
|
9 |
+
apt-get update && apt-get install -y \
|
10 |
+
curl \
|
11 |
+
wget \
|
12 |
+
ca-certificates \
|
13 |
+
sudo \
|
14 |
+
git \
|
15 |
+
git-lfs \
|
16 |
+
zip \
|
17 |
+
unzip \
|
18 |
+
htop \
|
19 |
+
bzip2 \
|
20 |
+
libx11-6 \
|
21 |
+
build-essential \
|
22 |
+
libsndfile-dev \
|
23 |
+
software-properties-common \
|
24 |
+
&& rm -rf /var/lib/apt/lists/*
|
25 |
+
|
26 |
+
# Install openvscode-server runtime dependencies
|
27 |
+
RUN apt-get update && \
|
28 |
+
apt-get install -y \
|
29 |
+
jq \
|
30 |
+
libatomic1 \
|
31 |
+
nano \
|
32 |
+
net-tools \
|
33 |
+
netcat
|
34 |
+
|
35 |
+
COPY root/ /
|
36 |
+
|
37 |
+
# Create a working directory
|
38 |
+
WORKDIR /app
|
39 |
+
|
40 |
+
# Create a non-root user and switch to it
|
41 |
+
RUN adduser --disabled-password --gecos '' --shell /bin/bash user \
|
42 |
+
&& chown -R user:user /app
|
43 |
+
RUN echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-user
|
44 |
+
|
45 |
+
# Fetch the latest version of OpenVSCode Server
|
46 |
+
RUN curl -s https://api.github.com/repos/gitpod-io/openvscode-server/releases/latest \
|
47 |
+
| grep "browser_download_url.*linux-x64.tar.gz" \
|
48 |
+
| cut -d : -f 2,3 \
|
49 |
+
| tr -d \" \
|
50 |
+
| wget -qi - -O /tmp/openvscode-server.tar.gz && \
|
51 |
+
# Install OpenVSCode Server
|
52 |
+
mkdir -p /app/openvscode-server && \
|
53 |
+
tar -xzf /tmp/openvscode-server.tar.gz --strip-components=1 -C /app/openvscode-server \
|
54 |
+
# Clean up the temporary file
|
55 |
+
&& rm /tmp/openvscode-server.tar.gz \
|
56 |
+
&& rm -rf /var/lib/apt/lists/* \
|
57 |
+
&& rm -rf /var/tmp/*
|
58 |
+
|
59 |
+
# Install Node.js and configurable-http-proxy
|
60 |
+
RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \
|
61 |
+
&& apt-get install -y nodejs \
|
62 |
+
&& npm install -g configurable-http-proxy \
|
63 |
+
&& rm -rf /var/lib/apt/lists/* \
|
64 |
+
&& rm -rf /var/tmp/*
|
65 |
+
|
66 |
+
# Install Golang
|
67 |
+
ARG GOLANG_VERSION="1.20"
|
68 |
+
RUN curl -LO "https://golang.org/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz" && \
|
69 |
+
tar -C /usr/local -xzf "go${GOLANG_VERSION}.linux-amd64.tar.gz" && \
|
70 |
+
rm "go${GOLANG_VERSION}.linux-amd64.tar.gz" && \
|
71 |
+
mkdir /go && \
|
72 |
+
chown -R user:user /go && \
|
73 |
+
chmod -R 777 /go
|
74 |
+
|
75 |
+
# Set Golang environment variables
|
76 |
+
ENV PATH="/usr/local/go/bin:${PATH}" \
|
77 |
+
GOPATH="/go" \
|
78 |
+
GOBIN="/go/bin"
|
79 |
+
|
80 |
+
# Install VS Code
|
81 |
+
RUN wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | apt-key add - \
|
82 |
+
&& apt-get update \
|
83 |
+
&& apt-get install -y apt-transport-https \
|
84 |
+
&& echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" | tee /etc/apt/sources.list.d/vscode.list \
|
85 |
+
&& apt-get update \
|
86 |
+
&& apt-get install -y code \
|
87 |
+
&& rm -rf /var/cache/apt/* \
|
88 |
+
&& rm -rf /var/lib/apt/lists/* \
|
89 |
+
&& rm -rf /var/tmp/*
|
90 |
+
|
91 |
+
USER user
|
92 |
+
|
93 |
+
# All users can use /home/user as their home directory
|
94 |
+
ENV HOME=/home/user
|
95 |
+
RUN mkdir $HOME/.cache $HOME/.config \
|
96 |
+
&& chmod -R 777 $HOME
|
97 |
+
|
98 |
+
# Set up the Conda environment
|
99 |
+
ENV CONDA_AUTO_UPDATE_CONDA=false \
|
100 |
+
PATH=$HOME/miniconda/bin:$PATH
|
101 |
+
RUN curl -sLo ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \
|
102 |
+
&& chmod +x ~/miniconda.sh \
|
103 |
+
&& ~/miniconda.sh -b -p ~/miniconda \
|
104 |
+
&& rm ~/miniconda.sh \
|
105 |
+
&& conda clean -ya
|
106 |
+
|
107 |
+
WORKDIR $HOME/app
|
108 |
+
|
109 |
+
#######################################
|
110 |
+
# Start root user section
|
111 |
+
#######################################
|
112 |
+
|
113 |
+
USER root
|
114 |
+
|
115 |
+
# User Debian packages
|
116 |
+
## Security warning : Potential user code executed as root (build time)
|
117 |
+
RUN --mount=target=/root/packages.txt,source=packages.txt \
|
118 |
+
apt-get update && \
|
119 |
+
xargs -r -a /root/packages.txt apt-get install -y --no-install-recommends \
|
120 |
+
&& rm -rf /var/lib/apt/lists/*
|
121 |
+
|
122 |
+
RUN --mount=target=/root/on_startup.sh,source=on_startup.sh,readwrite \
|
123 |
+
bash /root/on_startup.sh
|
124 |
+
|
125 |
+
RUN --mount=target=/root/npm_packages.txt,source=npm_packages.txt \
|
126 |
+
xargs -r -a /root/npm_packages.txt /usr/bin/npm install -g \
|
127 |
+
|
128 |
+
#######################################
|
129 |
+
# End root user section
|
130 |
+
#######################################
|
131 |
+
|
132 |
+
USER user
|
133 |
+
|
134 |
+
# Python packages
|
135 |
+
RUN --mount=target=requirements.txt,source=requirements.txt \
|
136 |
+
pip install --no-cache-dir --upgrade -r requirements.txt
|
137 |
+
|
138 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
139 |
+
COPY --chown=user . $HOME/app
|
140 |
+
|
141 |
+
RUN chmod +x start_server.sh
|
142 |
+
|
143 |
+
ENV PYTHONUNBUFFERED=1 \
|
144 |
+
GRADIO_ALLOW_FLAGGING=never \
|
145 |
+
GRADIO_NUM_PORTS=1 \
|
146 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
147 |
+
GRADIO_THEME=huggingface \
|
148 |
+
SYSTEM=spaces \
|
149 |
+
SHELL=/bin/bash
|
150 |
+
|
151 |
+
EXPOSE 7860 3000 3700
|
152 |
+
|
153 |
+
CMD ["./start_server.sh"]
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: poe-API
|
3 |
+
emoji: 💻🐳
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: blue
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
tags:
|
9 |
+
- vscode
|
10 |
+
duplicated_from: Unsterile/onee
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
npm_packages.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
cloudflared
|
2 |
+
localtunnel
|
on_startup.sh
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
# Write some commands here that will run on root user before startup.
|
3 |
+
# For example, to clone transformers and install it in dev mode:
|
4 |
+
# git clone https://github.com/huggingface/transformers.git
|
5 |
+
# cd transformers && pip install -e ".[dev]"
|
6 |
+
# useradd -m aku && adduser aku sudo && echo 'aku:aku' | sudo chpasswd && sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
|
7 |
+
# /usr/bin/newuidmap 1500 0 1000 1 1 100000 65536
|
packages.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
tree
|
2 |
+
neofetch
|
3 |
+
neovim
|
4 |
+
nginx
|
5 |
+
autossh
|
6 |
+
ripgrep
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
#jupyterlab
|
root/etc/s6-overlay/s6-rc.d/init-config-end/dependencies.d/init-openvscode-server
ADDED
File without changes
|
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/dependencies.d/init-config
ADDED
File without changes
|
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/run
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/with-contenv bash
|
2 |
+
|
3 |
+
mkdir -p /config/{workspace,.ssh}
|
4 |
+
|
5 |
+
if [ -n "${SUDO_PASSWORD}" ] || [ -n "${SUDO_PASSWORD_HASH}" ]; then
|
6 |
+
echo "setting up sudo access"
|
7 |
+
if ! grep -q 'abc' /etc/sudoers; then
|
8 |
+
echo "adding abc to sudoers"
|
9 |
+
echo "abc ALL=(ALL:ALL) ALL" >> /etc/sudoers
|
10 |
+
fi
|
11 |
+
if [ -n "${SUDO_PASSWORD_HASH}" ]; then
|
12 |
+
echo "setting sudo password using sudo password hash"
|
13 |
+
sed -i "s|^abc:\!:|abc:${SUDO_PASSWORD_HASH}:|" /etc/shadow
|
14 |
+
else
|
15 |
+
echo "setting sudo password using SUDO_PASSWORD env var"
|
16 |
+
echo -e "${SUDO_PASSWORD}\n${SUDO_PASSWORD}" | passwd abc
|
17 |
+
fi
|
18 |
+
fi
|
19 |
+
|
20 |
+
[[ ! -f /config/.bashrc ]] && \
|
21 |
+
cp /root/.bashrc /config/.bashrc
|
22 |
+
[[ ! -f /config/.profile ]] && \
|
23 |
+
cp /root/.profile /config/.profile
|
24 |
+
|
25 |
+
# fix permissions (ignore contents of /config/workspace)
|
26 |
+
echo "setting permissions::config"
|
27 |
+
find /config -path /config/workspace -prune -o -exec chown abc:abc {} +
|
28 |
+
chown abc:abc /config/workspace
|
29 |
+
echo "setting permissions::app"
|
30 |
+
chown -R abc:abc /app/openvscode-server
|
31 |
+
|
32 |
+
chmod 700 /config/.ssh
|
33 |
+
if [ -n "$(ls -A /config/.ssh)" ]; then
|
34 |
+
chmod 600 /config/.ssh/*
|
35 |
+
fi
|
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/type
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
oneshot
|
root/etc/s6-overlay/s6-rc.d/init-openvscode-server/up
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
/etc/s6-overlay/s6-rc.d/init-openvscode-server/run
|
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/dependencies.d/init-services
ADDED
File without changes
|
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/notification-fd
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3
|
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/run
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/with-contenv bash
|
2 |
+
|
3 |
+
if [ -n "$CONNECTION_SECRET" ]; then
|
4 |
+
CODE_ARGS="${CODE_ARGS} --connection-secret ${CONNECTION_SECRET}"
|
5 |
+
echo "Using connection secret from ${CONNECTION_SECRET}"
|
6 |
+
elif [ -n "$CONNECTION_TOKEN" ]; then
|
7 |
+
CODE_ARGS="${CODE_ARGS} --connection-token ${CONNECTION_TOKEN}"
|
8 |
+
echo "Using connection token ${CONNECTION_TOKEN}"
|
9 |
+
else
|
10 |
+
CODE_ARGS="${CODE_ARGS} --without-connection-token"
|
11 |
+
echo "**** No connection token is set ****"
|
12 |
+
fi
|
13 |
+
|
14 |
+
exec \
|
15 |
+
s6-notifyoncheck -d -n 300 -w 1000 -c "nc -z 127.0.0.1 3000" \
|
16 |
+
cd /app/openvscode-server s6-setuidgid abc \
|
17 |
+
/app/openvscode-server/bin/openvscode-server \
|
18 |
+
--host 0.0.0.0 \
|
19 |
+
--port 3000 \
|
20 |
+
--disable-telemetry \
|
21 |
+
${CODE_ARGS}
|
root/etc/s6-overlay/s6-rc.d/svc-openvscode-server/type
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
longrun
|
root/etc/s6-overlay/s6-rc.d/user/contents.d/init-openvscode-server
ADDED
File without changes
|
root/etc/s6-overlay/s6-rc.d/user/contents.d/svc-openvscode-server
ADDED
File without changes
|
root/usr/local/bin/install-extension
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/with-contenv bash
|
2 |
+
# shellcheck shell=bash
|
3 |
+
|
4 |
+
_install=(/app/openvscode-server/bin/openvscode-server "--install-extension")
|
5 |
+
|
6 |
+
if [ "$(whoami)" == "abc" ]; then
|
7 |
+
"${_install[@]}" "$@"
|
8 |
+
else
|
9 |
+
s6-setuidgid abc "${_install[@]}" "$@"
|
10 |
+
fi
|
start_server.sh
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/bash
|
2 |
+
|
3 |
+
echo "Starting VSCode Server..."
|
4 |
+
/app/openvscode-server/bin/openvscode-server --host 0.0.0.0 --port 7860 --without-connection-token "${@}" &
|
5 |
+
|
6 |
+
echo "Starting Code Tunnel..."
|
7 |
+
/usr/bin/code tunnel --accept-server-license-terms &
|
8 |
+
|
9 |
+
# Sleep for a long time to keep the container running
|
10 |
+
sleep infinity
|