Spaces:
Running
Running
orztv
commited on
Commit
·
ddf1b87
1
Parent(s):
8d8f96f
update
Browse files- Dockerfile +66 -0
- README.md +1 -0
Dockerfile
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# 使用 PostgreSQL 作为基础镜像
|
2 |
+
FROM nikolaik/python-nodejs:python3.12-nodejs20
|
3 |
+
|
4 |
+
# 添加维护者信息
|
5 |
+
LABEL maintainer="ai来事 <交流群:https://qr61.cn/oohivs/qRp62U6>"
|
6 |
+
|
7 |
+
ARG CACHEBUST=2
|
8 |
+
|
9 |
+
# 设置构建参数,提供默认值
|
10 |
+
ARG WEBHOOK_URL=https://你的hf账户名-空间名.hf.space/
|
11 |
+
|
12 |
+
|
13 |
+
# 设置基本环境变量
|
14 |
+
ENV WEBHOOK_URL=${WEBHOOK_URL}
|
15 |
+
|
16 |
+
# 安装系统依赖
|
17 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
18 |
+
curl \
|
19 |
+
unzip \
|
20 |
+
gnupg \
|
21 |
+
build-essential \
|
22 |
+
sudo \
|
23 |
+
vim \
|
24 |
+
git \
|
25 |
+
procps \
|
26 |
+
lsof \
|
27 |
+
net-tools \
|
28 |
+
ca-certificates \
|
29 |
+
openssl \
|
30 |
+
tzdata \
|
31 |
+
htop \
|
32 |
+
jq \
|
33 |
+
netcat-openbsd \
|
34 |
+
redis-server \
|
35 |
+
&& ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
36 |
+
&& dpkg-reconfigure --frontend noninteractive tzdata \
|
37 |
+
# 清理
|
38 |
+
&& apt-get clean \
|
39 |
+
&& rm -rf /var/lib/apt/lists/*
|
40 |
+
|
41 |
+
# 创建环境变量文件
|
42 |
+
RUN --mount=type=secret,id=POSTGRES_USER,mode=0444,required=true \
|
43 |
+
--mount=type=secret,id=POSTGRES_PASSWORD,mode=0444,required=true \
|
44 |
+
--mount=type=secret,id=POSTGRES_DB,mode=0444,required=true \
|
45 |
+
--mount=type=secret,id=POSTGRESDB_HOST,mode=0444,required=true \
|
46 |
+
echo "export DB_POSTGRESDB_HOST=$(cat /run/secrets/POSTGRESDB_HOST)" >> /home/pn/.env && \
|
47 |
+
echo "export DB_POSTGRESDB_USER=$(cat /run/secrets/POSTGRES_USER)" >> /home/pn/.env && \
|
48 |
+
echo "export DB_POSTGRESDB_PASSWORD=$(cat /run/secrets/POSTGRES_PASSWORD)" >> /home/pn/.env && \
|
49 |
+
echo "export DB_POSTGRESDB_DATABASE=$(cat /run/secrets/POSTGRES_DB)" >> /home/pn/.env && \
|
50 |
+
chown pn:pn /home/pn/.env
|
51 |
+
|
52 |
+
# 创建工作目录
|
53 |
+
WORKDIR /home/pn
|
54 |
+
|
55 |
+
# 复制启动脚本并创建数据目录
|
56 |
+
RUN cd /home/pn && git clone https://github.com/aigem/deepseek-free-api.git \
|
57 |
+
&& cd deepseek-free-api && npm i && npm run build
|
58 |
+
|
59 |
+
# 暴露端口
|
60 |
+
EXPOSE 8000
|
61 |
+
|
62 |
+
# 切换到非 root 用户
|
63 |
+
USER pn
|
64 |
+
|
65 |
+
# 启动命令
|
66 |
+
CMD ["./run.sh"]
|
README.md
CHANGED
@@ -5,6 +5,7 @@ colorFrom: indigo
|
|
5 |
colorTo: purple
|
6 |
sdk: docker
|
7 |
pinned: false
|
|
|
8 |
---
|
9 |
|
10 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
5 |
colorTo: purple
|
6 |
sdk: docker
|
7 |
pinned: false
|
8 |
+
app_port: 8000
|
9 |
---
|
10 |
|
11 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|