File size: 1,570 Bytes
014fc6f
8ac4e47
2ef966b
235432a
a636075
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2ef966b
 
 
 
 
 
 
 
f28c874
 
 
 
 
 
2ef966b
 
c2ff1e7
 
2ef966b
 
 
c2e7725
2ef966b
 
6c40988
2ef966b
 
e020404
2ef966b
 
6c40988
2ef966b
 
 
d46d417
2ef966b
6c40988
2ef966b
e020404
 
6c40988
2ef966b
 
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
FROM mcr.microsoft.com/playwright:v1.49.0-noble

WORKDIR /code

RUN apt-get update && apt-get install -y --no-install-recommends \
    libglib2.0-0 \
    libnss3 \
    libnspr4 \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libdrm2 \
    libdbus-1-3 \
    libxcb1 \
    libxkbcommon0 \
    libx11-6 \
    libxcomposite1 \
    libxdamage1 \
    libxext6 \
    libxfixes3 \
    libxrandr2 \
    libgbm1 \
    libpango-1.0-0 \
    libcairo2 \
    libatspi2.0-0 \
    && rm -rf /var/lib/apt/lists/*

# Cài đặt các gói phụ thuộc cần thiết
RUN apt-get update && apt-get install -y \
    python3-pip \
    python3-venv \
    ffmpeg \
    libsm6 \
    libxext6 \
    poppler-utils \
    libatk1.0-0 \
    libatk-bridge2.0-0 \
    libcups2 \
    libxcomposite1 \
    libxdamage1 \
    libatspi2.0-0 \
    chromium \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Tạo môi trường ảo
RUN python3 -m venv /code/venv
ENV PATH="/code/venv/bin:$PATH"

# Cập nhật pip trong môi trường ảo
RUN pip install --no-cache-dir --upgrade pip setuptools wheel

# Cài đặt Playwright và các thư viện
RUN pip install playwright
RUN playwright install
RUN playwright install-deps
RUN playwright install chromium

# Sao chép mã nguồn
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
RUN playwright install chromium
COPY . .

# Mở cổng
EXPOSE 7860
EXPOSE 9222

# Khởi động ứng dụng
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]