th commited on
Commit
25faf9b
·
1 Parent(s): 4d9617f

Fix Dockerfile: Use --with-deps for Playwright installation

Browse files

Changes:
- Replace separate `playwright install-deps` with `--with-deps` flag
- Add fonts-noto-cjk-extra for better Chinese character coverage
- Simplify dependency installation to avoid package name conflicts

This fixes the HF Space build error:
E: Package 'ttf-unifont' has no installation candidate
E: Package 'ttf-ubuntu-font-family' has no installation candidate

🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>

Files changed (1) hide show
  1. Dockerfile +6 -6
Dockerfile CHANGED
@@ -2,12 +2,15 @@ FROM python:3.11-slim
2
 
3
  WORKDIR /app
4
 
5
- # Install system dependencies for Playwright
6
  RUN apt-get update && apt-get install -y \
7
  wget \
8
  gnupg \
9
  ca-certificates \
10
  fonts-liberation \
 
 
 
11
  libasound2 \
12
  libatk-bridge2.0-0 \
13
  libatk1.0-0 \
@@ -18,7 +21,6 @@ RUN apt-get update && apt-get install -y \
18
  libexpat1 \
19
  libfontconfig1 \
20
  libgbm1 \
21
- libgcc1 \
22
  libglib2.0-0 \
23
  libgtk-3-0 \
24
  libnspr4 \
@@ -41,8 +43,6 @@ RUN apt-get update && apt-get install -y \
41
  libxtst6 \
42
  lsb-release \
43
  xdg-utils \
44
- fonts-noto-color-emoji \
45
- fonts-noto-cjk \
46
  && rm -rf /var/lib/apt/lists/*
47
 
48
  # Copy requirements and install Python packages
@@ -50,8 +50,8 @@ COPY requirements.txt .
50
  RUN pip install --no-cache-dir -r requirements.txt
51
 
52
  # Install Playwright browsers (Chromium only to save space)
53
- RUN playwright install chromium
54
- RUN playwright install-deps chromium
55
 
56
  # Copy application code
57
  COPY app.py .
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install system dependencies for Playwright + Chinese/Emoji fonts
6
  RUN apt-get update && apt-get install -y \
7
  wget \
8
  gnupg \
9
  ca-certificates \
10
  fonts-liberation \
11
+ fonts-noto-color-emoji \
12
+ fonts-noto-cjk \
13
+ fonts-noto-cjk-extra \
14
  libasound2 \
15
  libatk-bridge2.0-0 \
16
  libatk1.0-0 \
 
21
  libexpat1 \
22
  libfontconfig1 \
23
  libgbm1 \
 
24
  libglib2.0-0 \
25
  libgtk-3-0 \
26
  libnspr4 \
 
43
  libxtst6 \
44
  lsb-release \
45
  xdg-utils \
 
 
46
  && rm -rf /var/lib/apt/lists/*
47
 
48
  # Copy requirements and install Python packages
 
50
  RUN pip install --no-cache-dir -r requirements.txt
51
 
52
  # Install Playwright browsers (Chromium only to save space)
53
+ # Use PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=0 to ensure browser is installed
54
+ RUN playwright install chromium --with-deps
55
 
56
  # Copy application code
57
  COPY app.py .