yangtb24 commited on
Commit
7cad8a6
·
verified ·
1 Parent(s): 902ed7e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -1
Dockerfile CHANGED
@@ -2,13 +2,28 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /code
4
 
 
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
 
8
  COPY . .
9
 
10
- RUN mkdir -p /code/data
 
 
 
 
 
 
11
 
 
12
  EXPOSE 7860
13
 
 
 
 
 
 
 
14
  CMD ["python", "app.py"]
 
2
 
3
  WORKDIR /code
4
 
5
+ # 安装依赖
6
  COPY requirements.txt .
7
  RUN pip install --no-cache-dir -r requirements.txt
8
 
9
+ # 复制应用代码
10
  COPY . .
11
 
12
+ # 创建必要的数据目录和文件并设置正确权限
13
+ RUN mkdir -p /code/data && \
14
+ touch /code/data/auth_tokens.json && \
15
+ touch /code/data/api_keys.json && \
16
+ echo '{"tokens":{}}' > /code/data/auth_tokens.json && \
17
+ echo '{"keys":[]}' > /code/data/api_keys.json && \
18
+ chmod 777 -R /code/data
19
 
20
+ # 配置HuggingFace Space端口
21
  EXPOSE 7860
22
 
23
+ # 环境变量
24
+ ENV SECRET_KEY="123456"
25
+ ENV FLASK_APP=app.py
26
+ ENV FLASK_ENV=production
27
+
28
+ # 运行应用
29
  CMD ["python", "app.py"]