kltn20133118 commited on
Commit
0959d97
·
verified ·
1 Parent(s): b8a2cb3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -51
Dockerfile CHANGED
@@ -1,8 +1,25 @@
1
- FROM mcr.microsoft.com/playwright:v1.49.0-noble
 
 
 
2
 
3
  # Thiết lập thư mục làm việc
4
- WORKDIR /code
5
- # Cập nhật và cài đặt các gói hệ thống cần thiết
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  RUN apt-get update && apt-get install -y --no-install-recommends \
7
  libglib2.0-0 \
8
  libnss3 \
@@ -23,51 +40,18 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
23
  libgbm1 \
24
  libpango-1.0-0 \
25
  libcairo2 \
 
26
  libatspi2.0-0 \
27
- libwoff1 \
28
- libopus0 \
29
- libwebp7 \
30
- libwebpdemux2 \
31
- libenchant-2-2 \
32
- libgudev-1.0-0 \
33
- libsecret-1-0 \
34
- libhyphen0 \
35
- libgdk-pixbuf2.0-0 \
36
- libegl1 \
37
- libnotify4 \
38
- libxslt1.1 \
39
- libevent-2.1-7 \
40
- libgles2 \
41
- libepoxy0 \
42
- libgtk-3-0 \
43
- libharfbuzz-icu0 \
44
- libgstreamer-gl1.0-0 \
45
- libgstreamer-plugins-bad1.0-0 \
46
- gstreamer1.0-plugins-good \
47
- gstreamer1.0-plugins-bad \
48
- libxt6 \
49
- libxaw7 \
50
- xvfb \
51
- fonts-noto-color-emoji \
52
- libfontconfig \
53
- libfreetype6 \
54
- xfonts-cyrillic \
55
- xfonts-scalable \
56
- fonts-liberation \
57
- fonts-ipafont-gothic \
58
- fonts-wqy-zenhei \
59
- fonts-tlwg-loma-otf \
60
- fonts-freefont-ttf \
61
- python3-pip \
62
- python3-venv \
63
- ffmpeg \
64
- libsm6 \
65
- libxext6 \
66
- poppler-utils \
67
- chromium \
68
- && apt-get clean \
69
  && rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
 
70
 
 
71
  # Cài đặt môi trường ảo Python
72
  RUN python3 -m venv /code/venv
73
  ENV PATH="/code/venv/bin:$PATH"
@@ -93,18 +77,14 @@ RUN playwright install chromium
93
 
94
  # Sao chép mã nguồn vào container
95
  COPY . .
96
- RUN playwright install chromium
97
  RUN pip install playwright
98
  RUN playwright install
99
  RUN playwright install-deps
100
  RUN playwright install chromium
101
- RUN pip install --upgrade --ignore-installed playwright
102
- RUN playwright install --with-deps chromium
103
 
104
 
105
- # Mở các cổng cần thiết cho ứng dụng
106
- EXPOSE 7860
107
- EXPOSE 9222
108
 
109
  # Khởi động ứng dụng
110
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FARG PYTHON_VERSION=3.10
2
+
3
+ # Base stage with system dependencies
4
+ FROM python:${PYTHON_VERSION}-slim as base
5
 
6
  # Thiết lập thư mục làm việc
7
+
8
+ # Install system dependencies
9
+ RUN apt-get update && apt-get install -y --no-install-recommends \
10
+ build-essential \
11
+ curl \
12
+ wget \
13
+ gnupg \
14
+ git \
15
+ cmake \
16
+ pkg-config \
17
+ python3-dev \
18
+ libjpeg-dev \
19
+ libpng-dev \
20
+ && rm -rf /var/lib/apt/lists/*
21
+
22
+ # Playwright system dependencies for Linux
23
  RUN apt-get update && apt-get install -y --no-install-recommends \
24
  libglib2.0-0 \
25
  libnss3 \
 
40
  libgbm1 \
41
  libpango-1.0-0 \
42
  libcairo2 \
43
+ libasound2 \
44
  libatspi2.0-0 \
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  && rm -rf /var/lib/apt/lists/*
46
+
47
+ ENV PYTHONUNBUFFERED=1 \
48
+ PYTHONDONTWRITEBYTECODE=1 \
49
+ PIP_NO_CACHE_DIR=1 \
50
+ PIP_DISABLE_PIP_VERSION_CHECK=1 \
51
+ PIP_DEFAULT_TIMEOUT=100 \
52
+ DEBIAN_FRONTEND=noninteractive
53
 
54
+ WORKDIR /code
55
  # Cài đặt môi trường ảo Python
56
  RUN python3 -m venv /code/venv
57
  ENV PATH="/code/venv/bin:$PATH"
 
77
 
78
  # Sao chép mã nguồn vào container
79
  COPY . .
 
80
  RUN pip install playwright
81
  RUN playwright install
82
  RUN playwright install-deps
83
  RUN playwright install chromium
 
 
84
 
85
 
86
+ EXPOSE 7860 9222
87
+
 
88
 
89
  # Khởi động ứng dụng
90
  CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]