File size: 784 Bytes
66227c9
 
4b81477
975f5f4
 
 
66227c9
 
e0bac51
66227c9
b2a76fd
e0bac51
2686e37
 
 
 
66227c9
 
4b81477
394ada2
ce37fa6
2686e37
 
 
b583fef
12810cf
 
 
2aea7f9
2f7c317
975f5f4
 
4b81477
12810cf
 
 
b2a76fd
 
 
394ada2
2686e37
b2a76fd
66227c9
 
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
# 使用 Node.js LTS 版本作为基础镜像
FROM node:lts-alpine

# 设置工作目录
WORKDIR /app

# 安装 git
RUN apk add --no-cache git

# 克隆项目仓库
RUN git clone https://github.com/LLM-Red-Team/deepseek-free-api.git .

# 替换字符串, 使用更精确的匹配
RUN sed -i "s|^\s*prefix: '/v1/chat'|prefix: '/hf/v1/chat'|" src/api/routes/chat.ts


# 设置时区
ENV TZ=Asia/Shanghai

RUN yarn config set registry https://registry.npmmirror.com/ && \
    yarn install && \
    yarn run build

    

# 关键更改: 创建 /app/logs 目录并赋予 node 用户权限
RUN mkdir -p /app/logs && chown -R node:node /app/logs



# 暴露端口
EXPOSE 8000

# 使用 node 用户运行应用
USER node



# 安装依赖并构建项目



# 启动应用
CMD ["npm", "start"]