leonsimon23 commited on
Commit
c43a3df
·
verified ·
1 Parent(s): f237c8c

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -12
Dockerfile CHANGED
@@ -1,38 +1,39 @@
1
- # Use the official Python slim image as the base
2
  FROM python:3.10-slim
3
 
4
- # Set environment variables to optimize Python
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
- # Set the working directory in the container
9
  WORKDIR /app
10
 
11
- # Install system dependencies
12
  RUN apt-get update && apt-get install -y \
13
  build-essential \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
- # Copy the requirements file into the container
17
  COPY requirements.txt .
18
 
19
- # Install Python dependencies
20
  RUN pip install --upgrade pip && \
21
  pip install --no-cache-dir -r requirements.txt
22
 
23
- # Copy the rest of the application code into the container
24
  COPY . .
25
 
26
- # Make port 8000 available to the world outside this container
 
 
 
27
  EXPOSE 8000
28
 
29
- # Define environment variables (you can also set these in Huggingface Spaces settings)
30
- # It's recommended to use secrets management for sensitive information
31
  ENV CHAINLIT_AUTH_SECRET="xOIPIMBGfI7N*VK6O~KOVIRC/cGRNSmk%bmO4Q@el647hR?^mdW6=8KlQBuWWTbk"
32
  ENV FASTGPT_BASE_URL="https://share.fastgpt.in"
33
  ENV FASTGPT_API_KEY="fastgpt-key"
34
  ENV FASTGPT_SHARE_ID=""
35
  ENV FASTGPT_API_DETAIL=False
36
 
37
- # Define the default command to run the Chainlit application
38
- CMD ["chainlit", "run", "app.py", "-w", "--host", "0.0.0.0", "--port", "8000"]
 
1
+ # 使用官方的 Python slim 镜像作为基础
2
  FROM python:3.10-slim
3
 
4
+ # 设置环境变量以优化 Python
5
  ENV PYTHONDONTWRITEBYTECODE=1
6
  ENV PYTHONUNBUFFERED=1
7
 
8
+ # 设置工作目录
9
  WORKDIR /app
10
 
11
+ # 安装系统依赖
12
  RUN apt-get update && apt-get install -y \
13
  build-essential \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # 复制 requirements 文件并安装依赖
17
  COPY requirements.txt .
18
 
 
19
  RUN pip install --upgrade pip && \
20
  pip install --no-cache-dir -r requirements.txt
21
 
22
+ # 复制应用程序代码
23
  COPY . .
24
 
25
+ # 创建 .files 目录并设置权限
26
+ RUN mkdir /app/.files && chmod 755 /app/.files
27
+
28
+ # 暴露端口 8000
29
  EXPOSE 8000
30
 
31
+ # 定义环境变量(建议在部署平台上设置)
 
32
  ENV CHAINLIT_AUTH_SECRET="xOIPIMBGfI7N*VK6O~KOVIRC/cGRNSmk%bmO4Q@el647hR?^mdW6=8KlQBuWWTbk"
33
  ENV FASTGPT_BASE_URL="https://share.fastgpt.in"
34
  ENV FASTGPT_API_KEY="fastgpt-key"
35
  ENV FASTGPT_SHARE_ID=""
36
  ENV FASTGPT_API_DETAIL=False
37
 
38
+ # 启动应用程序
39
+ CMD ["chainlit", "run", "app.py", "-w", "--host", "0.0.0.0", "--port", "8000"]