fokan commited on
Commit
0134048
·
verified ·
1 Parent(s): 0217eab

Upload 54 files

Browse files
Files changed (3) hide show
  1. BUILD_FIXES_SUMMARY.md +43 -0
  2. Dockerfile +2 -2
  3. app.py +1 -1
BUILD_FIXES_SUMMARY.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Build Fixes Summary
2
+
3
+ ## Problem Identified
4
+ The Docker build was failing with:
5
+ ```
6
+ E: Unable to locate package fonts-scheherazade-new
7
+ ```
8
+
9
+ ## Root Cause
10
+ The package `fonts-scheherazade-new` is not available in Ubuntu 22.04 (jammy), it's only available in Ubuntu 24.04 (noble) and later versions.
11
+
12
+ ## Solution Implemented
13
+ 1. **Fixed Package Name**: Changed `fonts-scheherazade-new` to `fonts-scheherazade` which is the correct package name for Ubuntu 22.04
14
+ 2. **Updated Cairo Font URL**: Changed to a more reliable source for Cairo font installation
15
+ 3. **Maintained Compatibility**: Kept Ubuntu 22.04 as the base image to ensure compatibility with Hugging Face Spaces
16
+
17
+ ## Changes Made
18
+
19
+ ### Dockerfile
20
+ - Replaced `fonts-scheherazade-new` with `fonts-scheherazade`
21
+ - Kept all other packages and configuration the same
22
+ - Maintained Java-disabling environment variables
23
+ - Preserved unoconv installation for fallback conversion
24
+
25
+ ### app.py
26
+ - Updated Cairo font URL to a more reliable source
27
+ - Kept all other Java-disabling logic and fallback mechanisms
28
+
29
+ ## Expected Results
30
+ These changes should resolve the build error and allow the Docker image to build successfully while maintaining all the Java-disabling and fallback conversion features.
31
+
32
+ ## Verification Steps
33
+ 1. Rebuild the Docker image
34
+ 2. Verify the image builds without errors
35
+ 3. Test document conversion to ensure all functionality works
36
+ 4. Check that Java is properly disabled
37
+ 5. Verify font installation works correctly
38
+
39
+ ## Additional Notes
40
+ - The `fonts-scheherazade` package provides the Scheherazade font which is suitable for Arabic text rendering
41
+ - The fallback mechanisms for conversion (LibreOffice → unoconv) remain in place
42
+ - All Java-disabling features are preserved
43
+ - Font installation improvements should provide better Arabic text support
Dockerfile CHANGED
@@ -41,8 +41,8 @@ RUN apt-get update && apt-get install -y \
41
  locales \
42
  # Add Microsoft fonts for Arial support
43
  fonts-freefont-ttf \
44
- # Add Scheherazade font for Arabic support
45
- fonts-scheherazade-new \
46
  # Add unoconv for fallback conversion
47
  unoconv \
48
  && rm -rf /var/lib/apt/lists/*
 
41
  locales \
42
  # Add Microsoft fonts for Arial support
43
  fonts-freefont-ttf \
44
+ # FIXED: Use correct package name for Ubuntu 22.04
45
+ fonts-scheherazade \
46
  # Add unoconv for fallback conversion
47
  unoconv \
48
  && rm -rf /var/lib/apt/lists/*
app.py CHANGED
@@ -288,7 +288,7 @@ def install_arabic_fonts():
288
  try:
289
  with tempfile.TemporaryDirectory() as tmp_dir:
290
  # Use a more reliable source for Cairo font
291
- cairo_url = "https://github.com/google/fonts/raw/main/ofl/cairo/Cairo-Regular.ttf"
292
  cairo_file = os.path.join(tmp_dir, "Cairo-Regular.ttf")
293
 
294
  urllib.request.urlretrieve(cairo_url, cairo_file)
 
288
  try:
289
  with tempfile.TemporaryDirectory() as tmp_dir:
290
  # Use a more reliable source for Cairo font
291
+ cairo_url = "https://github.com/Gue3bara/Cairo/raw/master/fonts/Cairo-Regular.ttf"
292
  cairo_file = os.path.join(tmp_dir, "Cairo-Regular.ttf")
293
 
294
  urllib.request.urlretrieve(cairo_url, cairo_file)