File size: 1,675 Bytes
60a7b9d
 
1e09d08
60a7b9d
 
 
 
 
 
9a1ee6a
60a7b9d
 
 
 
 
 
 
 
1e09d08
60a7b9d
 
 
 
 
9a1ee6a
60a7b9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1e09d08
9a1ee6a
 
1e09d08
9a1ee6a
 
 
 
 
60a7b9d
 
98c77e8
60a7b9d
 
98c77e8
4c7be44
 
 
 
 
9a1ee6a
4c7be44
 
60a7b9d
4c7be44
 
 
 
60a7b9d
4c7be44
 
9a1ee6a
60a7b9d
 
 
98c77e8
2a97c22
 
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
FROM python:3.10-slim

# 安装系统依赖 (只保留确实存在的包)
RUN apt-get update && apt-get install -y \
    wget \
    gnupg \
    ca-certificates \
    fonts-liberation \
    libasound2 \
    libasound2-dev \
    libatk-bridge2.0-0 \
    libatk1.0-0 \
    libc6 \
    libcairo2 \
    libcups2 \
    libdbus-1-3 \
    libexpat1 \
    libfontconfig1 \
    libgcc-s1 \
    libgdk-pixbuf2.0-0 \
    libglib2.0-0 \
    libgtk-3-0 \
    libnspr4 \
    libnss3 \
    libnss3-dev \
    libpango-1.0-0 \
    libpangocairo-1.0-0 \
    libstdc++6 \
    libx11-6 \
    libx11-xcb1 \
    libxcb1 \
    libxcomposite1 \
    libxcursor1 \
    libxdamage1 \
    libxext6 \
    libxfixes3 \
    libxi6 \
    libxrandr2 \
    libxrender1 \
    libxss1 \
    libxtst6 \
    lsb-release \
    xdg-utils \
    # 基础多媒体支持
    libgstreamer1.0-0 \
    libgstreamer-plugins-base1.0-0 \
    # 图形库
    libatomic1 \
    libxslt1.1 \
    libvpx7 \
    libevent-2.1-7 \
    libopus0 \
    && rm -rf /var/lib/apt/lists/*

# WORKDIR /app


WORKDIR /code
# RUN pip install --no-cache-dir -r requirements.txt
# Install Python dependencies
RUN pip install --upgrade pip
COPY requirements.txt .
RUN pip install -r requirements.txt

# Install Playwright and download the required browsers
RUN playwright install --with-deps

# Create and switch to a non-root user
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"

# Ensure Playwright browsers are installed for the non-root user
RUN playwright install

# 暴露端口
EXPOSE 7860

COPY --chown=user:user . /code
CMD ["sh", "-c", "python init_playwright.py && python app.py"]
# CMD ["python", "app.py"]