Update Dockerfile
Browse files- Dockerfile +15 -13
Dockerfile
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
|
|
| 1 |
FROM python:3.12-slim AS base
|
| 2 |
|
| 3 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
PYTHONUNBUFFERED=1 \
|
| 5 |
PIP_NO_CACHE_DIR=1 \
|
| 6 |
-
PORT=7860
|
|
|
|
| 7 |
|
| 8 |
-
# System
|
| 9 |
-
# Download Amiri TTF files directly (no unzip needed)
|
| 10 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 11 |
libpango-1.0-0 \
|
| 12 |
libpangoft2-1.0-0 \
|
|
@@ -18,29 +19,30 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 18 |
libcairo2 \
|
| 19 |
libgdk-pixbuf-2.0-0 \
|
| 20 |
shared-mime-info \
|
|
|
|
| 21 |
fonts-noto-core \
|
| 22 |
fonts-noto-cjk \
|
| 23 |
fonts-noto-color-emoji \
|
| 24 |
-
fonts-
|
| 25 |
curl \
|
| 26 |
-
&&
|
| 27 |
-
&&
|
| 28 |
-
&& curl -fsSL "https://github.com/aliftype/amiri/raw/main/Amiri-Regular.ttf" -o /usr/share/fonts/truetype/amiri/Amiri-Regular.ttf \
|
| 29 |
-
&& curl -fsSL "https://github.com/aliftype/amiri/raw/main/Amiri-Bold.ttf" -o /usr/share/fonts/truetype/amiri/Amiri-Bold.ttf \
|
| 30 |
-
&& curl -fsSL "https://github.com/aliftype/amiri/raw/main/Amiri-Italic.ttf" -o /usr/share/fonts/truetype/amiri/Amiri-Italic.ttf \
|
| 31 |
-
&& curl -fsSL "https://github.com/aliftype/amiri/raw/main/Amiri-BoldItalic.ttf" -o /usr/share/fonts/truetype/amiri/Amiri-BoldItalic.ttf \
|
| 32 |
-
&& fc-cache -fv
|
| 33 |
|
| 34 |
WORKDIR /app
|
| 35 |
|
|
|
|
| 36 |
COPY requirements.txt .
|
|
|
|
| 37 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 38 |
|
|
|
|
| 39 |
COPY app.py .
|
| 40 |
|
| 41 |
EXPOSE 7860
|
| 42 |
|
|
|
|
| 43 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
| 1 |
+
|
| 2 |
FROM python:3.12-slim AS base
|
| 3 |
|
| 4 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 5 |
PYTHONUNBUFFERED=1 \
|
| 6 |
PIP_NO_CACHE_DIR=1 \
|
| 7 |
+
PORT=7860 \
|
| 8 |
+
DEBIAN_FRONTEND=noninteractive
|
| 9 |
|
| 10 |
+
# System dependencies for WeasyPrint and Arabic RTL fonts
|
|
|
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 12 |
libpango-1.0-0 \
|
| 13 |
libpangoft2-1.0-0 \
|
|
|
|
| 19 |
libcairo2 \
|
| 20 |
libgdk-pixbuf-2.0-0 \
|
| 21 |
shared-mime-info \
|
| 22 |
+
fontconfig \
|
| 23 |
fonts-noto-core \
|
| 24 |
fonts-noto-cjk \
|
| 25 |
fonts-noto-color-emoji \
|
| 26 |
+
fonts-hosny-amiri \
|
| 27 |
curl \
|
| 28 |
+
&& fc-cache -f \
|
| 29 |
+
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
WORKDIR /app
|
| 32 |
|
| 33 |
+
# Install Python dependencies
|
| 34 |
COPY requirements.txt .
|
| 35 |
+
|
| 36 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 37 |
|
| 38 |
+
# Copy application
|
| 39 |
COPY app.py .
|
| 40 |
|
| 41 |
EXPOSE 7860
|
| 42 |
|
| 43 |
+
# Health check
|
| 44 |
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
| 45 |
+
CMD curl -f http://127.0.0.1:${PORT}/health || exit 1
|
| 46 |
|
| 47 |
+
# Start application
|
| 48 |
+
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT} --workers 2"]
|