xiaoyukkkk commited on
Commit
794962e
·
verified ·
1 Parent(s): b176f47

Upload Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -7
Dockerfile CHANGED
@@ -1,8 +1,10 @@
1
- # 后端运行环境
2
  FROM python:3.11-slim
3
  WORKDIR /app
4
 
5
- # 安装 Python 依赖
 
 
 
6
  COPY requirements.txt .
7
  RUN apt-get update && apt-get install -y --no-install-recommends \
8
  gcc \
@@ -11,16 +13,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
11
  && apt-get autoremove -y \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # 复制后端代码
15
  COPY main.py .
16
  COPY core ./core
17
  COPY util ./util
18
 
19
- # 创建数据目录(支持本地和 HF Spaces Pro)
 
 
 
20
  RUN mkdir -p ./data
21
 
22
- # 声明数据卷
23
  VOLUME ["/app/data"]
24
 
25
- # 启动服务
26
- CMD ["python", "-u", "main.py"]
 
 
1
  FROM python:3.11-slim
2
  WORKDIR /app
3
 
4
+ ENV PYTHONDONTWRITEBYTECODE=1 \
5
+ PYTHONUNBUFFERED=1
6
+
7
+ # Install Python dependencies
8
  COPY requirements.txt .
9
  RUN apt-get update && apt-get install -y --no-install-recommends \
10
  gcc \
 
13
  && apt-get autoremove -y \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # Copy backend code
17
  COPY main.py .
18
  COPY core ./core
19
  COPY util ./util
20
 
21
+ # Copy prebuilt static assets
22
+ COPY static ./static
23
+
24
+ # Create data directory (local + HF Spaces Pro)
25
  RUN mkdir -p ./data
26
 
27
+ # Declare data volume
28
  VOLUME ["/app/data"]
29
 
30
+ # Start service
31
+ CMD ["python", "-u", "main.py"]