Update Dockerfile
Browse files- Dockerfile +6 -12
Dockerfile
CHANGED
|
@@ -1,15 +1,12 @@
|
|
| 1 |
# ===============================
|
| 2 |
-
# 🐳 Dockerfile for Hugging Face Spaces - FastAPI + Gemini + Playwright
|
| 3 |
# ===============================
|
| 4 |
|
| 5 |
-
# 1️⃣ Use a lightweight Python base image
|
| 6 |
FROM python:3.10-slim
|
| 7 |
|
| 8 |
-
# 2️⃣ Set working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
# These are required to run Chromium headless in the container.
|
| 13 |
RUN apt-get update && apt-get install -y \
|
| 14 |
chromium \
|
| 15 |
libasound2 \
|
|
@@ -30,22 +27,19 @@ RUN apt-get update && apt-get install -y \
|
|
| 30 |
xdg-utils \
|
| 31 |
fonts-liberation \
|
| 32 |
fonts-unifont \
|
| 33 |
-
fonts-ubuntu \
|
| 34 |
&& rm -rf /var/lib/apt/lists/*
|
| 35 |
|
| 36 |
-
#
|
| 37 |
COPY requirements.txt .
|
| 38 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 39 |
|
| 40 |
-
#
|
| 41 |
-
# Using --with-deps=false since dependencies are already installed
|
| 42 |
RUN playwright install chromium --with-deps=false
|
| 43 |
|
| 44 |
-
#
|
| 45 |
COPY . .
|
| 46 |
|
| 47 |
-
# 7️⃣ Expose the default Hugging Face port
|
| 48 |
EXPOSE 7860
|
| 49 |
|
| 50 |
-
# 8️⃣ Start FastAPI using Uvicorn
|
| 51 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
# ===============================
|
| 2 |
+
# 🐳 Dockerfile for Hugging Face Spaces - FastAPI + Gemini + Playwright (Fixed Fonts)
|
| 3 |
# ===============================
|
| 4 |
|
|
|
|
| 5 |
FROM python:3.10-slim
|
| 6 |
|
|
|
|
| 7 |
WORKDIR /app
|
| 8 |
|
| 9 |
+
# Install system dependencies for Playwright (Chromium)
|
|
|
|
| 10 |
RUN apt-get update && apt-get install -y \
|
| 11 |
chromium \
|
| 12 |
libasound2 \
|
|
|
|
| 27 |
xdg-utils \
|
| 28 |
fonts-liberation \
|
| 29 |
fonts-unifont \
|
| 30 |
+
fonts-ubuntu-font-family-console \
|
| 31 |
&& rm -rf /var/lib/apt/lists/*
|
| 32 |
|
| 33 |
+
# Copy dependencies
|
| 34 |
COPY requirements.txt .
|
| 35 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 36 |
|
| 37 |
+
# Install Playwright Chromium (dependencies already installed)
|
|
|
|
| 38 |
RUN playwright install chromium --with-deps=false
|
| 39 |
|
| 40 |
+
# Copy all project files
|
| 41 |
COPY . .
|
| 42 |
|
|
|
|
| 43 |
EXPOSE 7860
|
| 44 |
|
|
|
|
| 45 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|