cruiserein22 commited on
Commit
378b27b
·
verified ·
1 Parent(s): b91cbda

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -11
Dockerfile CHANGED
@@ -1,10 +1,10 @@
1
- # 使用官方 Python 镜像作为基础镜像
2
  FROM python:3.9-slim
3
 
4
- # 设置工作目录
5
  WORKDIR /app
6
 
7
- # 安装系统依赖
8
  RUN apt-get update && apt-get install -y \
9
  libgl1-mesa-glx \
10
  libglib2.0-0 \
@@ -16,31 +16,34 @@ RUN apt-get update && apt-get install -y \
16
  fonts-liberation \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # 复制项目文件到容器中
20
  COPY . /app
21
 
22
- # 升级 pip
23
  RUN pip install --upgrade pip
24
 
25
- # 安装 Python 依赖
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
- # 设置环境变量
29
  ENV PYTHONUNBUFFERED=1
30
  ENV LANG=C.UTF-8
31
  ENV LC_ALL=C.UTF-8
32
  ENV MPLCONFIGDIR=/tmp/matplotlib
33
 
34
- # 创建必要的目录并设置权限
35
  RUN mkdir -p /.fonts /.config /app/models && \
36
  chmod -R 777 /.fonts /.config /app/models
37
 
38
  RUN mkdir -p /app/flagged && chmod 777 /app/flagged
39
 
 
 
 
40
 
41
- # 创建非 root 用户
42
  RUN useradd -m appuser
43
  USER appuser
44
 
45
- # 运行应用
46
- CMD ["python", "app.py"]
 
1
+ # Use the official Python image as a base image
2
  FROM python:3.9-slim
3
 
4
+ # Set the working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies
8
  RUN apt-get update && apt-get install -y \
9
  libgl1-mesa-glx \
10
  libglib2.0-0 \
 
16
  fonts-liberation \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
+ # Copy project files to the container
20
  COPY . /app
21
 
22
+ # Upgrade pip
23
  RUN pip install --upgrade pip
24
 
25
+ # Install Python dependencies
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
+ # Set environment variables
29
  ENV PYTHONUNBUFFERED=1
30
  ENV LANG=C.UTF-8
31
  ENV LC_ALL=C.UTF-8
32
  ENV MPLCONFIGDIR=/tmp/matplotlib
33
 
34
+ # Create necessary directories and set permissions
35
  RUN mkdir -p /.fonts /.config /app/models && \
36
  chmod -R 777 /.fonts /.config /app/models
37
 
38
  RUN mkdir -p /app/flagged && chmod 777 /app/flagged
39
 
40
+ # Download, rename, and move the specified file
41
+ RUN curl -L -o /tmp/frpc_linux_amd64 https://cdn-media.huggingface.co/frpc-gradio-0.2/frpc_linux_amd64 && \
42
+ mv /tmp/frpc_linux_amd64 /usr/local/lib/python3.9/site-packages/gradio/frpc_linux_amd64_v0.2
43
 
44
+ # Create a non-root user
45
  RUN useradd -m appuser
46
  USER appuser
47
 
48
+ # Run the application
49
+ CMD ["python", "app.py"]