File size: 1,254 Bytes
d3078fb
 
ab582df
 
 
 
d3078fb
ab582df
d3078fb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ab582df
 
 
 
 
 
 
 
f474a69
 
 
ab582df
 
 
d3078fb
 
 
ab582df
 
 
 
 
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
45
46
47
48
49
50
# 使用官方 Python 3.12-slim 镜像作为基础镜像
FROM python:3.12-slim

# 设置环境变量以确保 Python 输出被正确刷新
ENV PYTHONUNBUFFERED=1

# 安装 git 和 Playwright 运行所需的系统依赖
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        git \
        wget \
        libnss3 \
        libatk1.0-0 \
        libatk-bridge2.0-0 \
        libcups2 \
        libdrm2 \
        libxrandr2 \
        libxfixes3 \
        libxcomposite1 \
        libasound2 \
        libxdamage1 \
        libxrender1 \
        fonts-liberation \
        libgbm1 \
        ca-certificates \
        curl \
        gnupg && \
    rm -rf /var/lib/apt/lists/*

# 设置工作目录
WORKDIR /app

# 克隆指定的 GitHub 仓库
RUN git clone https://github.com/zhanghxiao/web-ui.git .

# 创建 tmp 目录并设置权限
RUN mkdir -p /app/tmp && chmod -R 777 /app/tmp

# 安装 Python 依赖
RUN pip install --no-cache-dir -r requirements.txt

# 安装 Playwright 并下载所需的浏览器
RUN pip install --no-cache-dir playwright && playwright install --with-deps

# 暴露应用所使用的端口
EXPOSE 7788

# 设置容器启动时运行的命令
CMD ["python", "webui.py", "--ip", "0.0.0.0", "--port", "7788"]