Spaces:
Paused
Paused
Upload 3 files
Browse files- .gitattributes +1 -0
- Dockerfile +99 -0
- README.md +20 -10
- chatbox +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
chatbox filter=lfs diff=lfs merge=lfs -text
|
Dockerfile
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:22.04
|
| 2 |
+
|
| 3 |
+
# Install necessary tools
|
| 4 |
+
RUN apt-get update && apt-get install -y \
|
| 5 |
+
tar \
|
| 6 |
+
gzip \
|
| 7 |
+
file \
|
| 8 |
+
jq \
|
| 9 |
+
curl \
|
| 10 |
+
sed \
|
| 11 |
+
aria2 \
|
| 12 |
+
unzip \
|
| 13 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 14 |
+
|
| 15 |
+
# Set up a new user named "user" with user ID 1000
|
| 16 |
+
RUN useradd -m -u 1000 user
|
| 17 |
+
|
| 18 |
+
# Switch to the "user" user
|
| 19 |
+
USER user
|
| 20 |
+
|
| 21 |
+
# Set home to the user's home directory
|
| 22 |
+
ENV HOME=/home/user \
|
| 23 |
+
PATH=/home/user/.local/bin:$PATH
|
| 24 |
+
|
| 25 |
+
# Set the working directory to the user's home directory
|
| 26 |
+
WORKDIR $HOME/chatbox
|
| 27 |
+
|
| 28 |
+
RUN mkdir -p $HOME/chatbox/data
|
| 29 |
+
|
| 30 |
+
COPY --chown=user . $HOME/chatbox
|
| 31 |
+
|
| 32 |
+
#use auto gen cfg file start
|
| 33 |
+
RUN --mount=type=secret,id=MYSQL_HOST,mode=0444,required=true \
|
| 34 |
+
--mount=type=secret,id=MYSQL_PORT,mode=0444,required=true \
|
| 35 |
+
--mount=type=secret,id=MYSQL_USER,mode=0444,required=true \
|
| 36 |
+
--mount=type=secret,id=MYSQL_PASSWORD,mode=0444,required=true \
|
| 37 |
+
--mount=type=secret,id=MYSQL_DATABASE,mode=0444,required=true \
|
| 38 |
+
ENV_MYSQL_HOST=$(cat /run/secrets/MYSQL_HOST) && \
|
| 39 |
+
ENV_MYSQL_PORT=$(cat /run/secrets/MYSQL_PORT) && \
|
| 40 |
+
ENV_MYSQL_USER=$(cat /run/secrets/MYSQL_USER) && \
|
| 41 |
+
ENV_MYSQL_PASSWORD=$(cat /run/secrets/MYSQL_PASSWORD) && \
|
| 42 |
+
ENV_MYSQL_DATABASE=$(cat /run/secrets/MYSQL_DATABASE) && \
|
| 43 |
+
echo "{\n\
|
| 44 |
+
\"force\": false,\n\
|
| 45 |
+
\"address\": \"0.0.0.0\",\n\
|
| 46 |
+
\"port\": 10086,\n\
|
| 47 |
+
\"scheme\": {\n\
|
| 48 |
+
\"https\": false,\n\
|
| 49 |
+
\"cert_file\": \"\",\n\
|
| 50 |
+
\"key_file\": \"\",\n\
|
| 51 |
+
\"http_port\": 10086\n\
|
| 52 |
+
},\n\
|
| 53 |
+
\"cache\": {\n\
|
| 54 |
+
\"expiration\": 60,\n\
|
| 55 |
+
\"cleanup_interval\": 120\n\
|
| 56 |
+
},\n\
|
| 57 |
+
\"database\": {\n\
|
| 58 |
+
\"type\": \"mysql\",\n\
|
| 59 |
+
\"host\": \"$ENV_MYSQL_HOST\",\n\
|
| 60 |
+
\"port\": $ENV_MYSQL_PORT,\n\
|
| 61 |
+
\"user\": \"$ENV_MYSQL_USER\",\n\
|
| 62 |
+
\"password\": \"$ENV_MYSQL_PASSWORD\",\n\
|
| 63 |
+
\"name\": \"$ENV_MYSQL_DATABASE\"\n\
|
| 64 |
+
}\n\
|
| 65 |
+
}" > $HOME/chatbox/test.json
|
| 66 |
+
|
| 67 |
+
#RUN --mount=type=secret,id=MYSQL_HOST,mode=0444,required=true \
|
| 68 |
+
# --mount=type=secret,id=MYSQL_PORT,mode=0444,required=true \
|
| 69 |
+
# --mount=type=secret,id=MYSQL_USER,mode=0444,required=true \
|
| 70 |
+
# --mount=type=secret,id=MYSQL_PASSWORD,mode=0444,required=true \
|
| 71 |
+
# --mount=type=secret,id=MYSQL_DATABASE,mode=0444,required=true \
|
| 72 |
+
# ENV_MYSQL_HOST=$(cat /run/secrets/MYSQL_HOST) && \
|
| 73 |
+
# ENV_MYSQL_PORT=$(cat /run/secrets/MYSQL_PORT) && \
|
| 74 |
+
# ENV_MYSQL_USER=$(cat /run/secrets/MYSQL_USER) && \
|
| 75 |
+
# ENV_MYSQL_PASSWORD=$(cat /run/secrets/MYSQL_PASSWORD) && \
|
| 76 |
+
# ENV_MYSQL_DATABASE=$(cat /run/secrets/MYSQL_DATABASE) && \
|
| 77 |
+
# sed -i "s/MYSQL_HOST/${ENV_MYSQL_HOST:-localhost}/g" $HOME/chatbox/test.json && \
|
| 78 |
+
# sed -i "s/MYSQL_PORT/${ENV_MYSQL_PORT:-3306}/g" $HOME/chatbox/test.json && \
|
| 79 |
+
# sed -i "s/MYSQL_USER/${ENV_MYSQL_USER:-root}/g" $HOME/chatbox/test.json && \
|
| 80 |
+
# sed -i "s/MYSQL_PASSWORD/${ENV_MYSQL_PASSWORD:-password}/g" $HOME/chatbox/test.json && \
|
| 81 |
+
# sed -i "s/MYSQL_DATABASE/${ENV_MYSQL_PASSWORD:-chatbox}/g" $HOME/chatbox/test.json
|
| 82 |
+
|
| 83 |
+
RUN cp -f $HOME/chatbox/test.json $HOME/chatbox/data/config.json
|
| 84 |
+
RUN cat $HOME/chatbox/data/config.json
|
| 85 |
+
#end
|
| 86 |
+
|
| 87 |
+
RUN chmod +x $HOME/chatbox/chatbox
|
| 88 |
+
|
| 89 |
+
# Create a startup script that runs chatbox and Aria2
|
| 90 |
+
RUN echo '#!/bin/bash\n\
|
| 91 |
+
aria2c --enable-rpc --rpc-listen-all --rpc-allow-origin-all --rpc-listen-port=6800 --daemon\n\
|
| 92 |
+
/home/user/chatbox/chatbox server --debug --data /home/user/chatbox/data/ --no-prefix' > $HOME/chatbox/start.sh && \
|
| 93 |
+
chmod +x $HOME/chatbox/start.sh
|
| 94 |
+
|
| 95 |
+
# Set the command to run when the container starts
|
| 96 |
+
CMD ["/bin/bash", "-c", "/home/user/chatbox/start.sh"]
|
| 97 |
+
|
| 98 |
+
# Expose the default chatbox port
|
| 99 |
+
EXPOSE 10086 6800
|
README.md
CHANGED
|
@@ -1,10 +1,20 @@
|
|
| 1 |
-
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: AI Box
|
| 3 |
+
|
| 4 |
+
emoji: ⚡
|
| 5 |
+
|
| 6 |
+
colorFrom: pink
|
| 7 |
+
|
| 8 |
+
colorTo: red
|
| 9 |
+
|
| 10 |
+
sdk: docker
|
| 11 |
+
|
| 12 |
+
pinned: false
|
| 13 |
+
|
| 14 |
+
license: mit
|
| 15 |
+
|
| 16 |
+
app_port : 10086
|
| 17 |
+
|
| 18 |
+
suggested_storage : large
|
| 19 |
+
|
| 20 |
+
---
|
chatbox
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:446088c7ab693b7c2e282170670f391d314f589e2790902361d9a7945a29ab85
|
| 3 |
+
size 136342424
|