Add poppler-utils for PDF processing
Browse files- Dockerfile +11 -10
Dockerfile
CHANGED
|
@@ -2,40 +2,41 @@
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
| 5 |
-
# PYTHONDONTWRITEBYTECODE: Prevents Python from writing pyc files to disc
|
| 6 |
-
# PYTHONUNBUFFERED: Ensures logs are flushed immediately
|
| 7 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 8 |
PYTHONUNBUFFERED=1 \
|
| 9 |
-
# Point Hugging Face cache to a writable directory
|
| 10 |
HF_HOME=/app/.cache/huggingface
|
| 11 |
|
| 12 |
# Set the working directory
|
| 13 |
WORKDIR /app
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
# and
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
RUN useradd -m -u 1000 user && \
|
| 18 |
chown -R user:user /app
|
| 19 |
|
| 20 |
# Switch to the non-root user
|
| 21 |
USER user
|
| 22 |
|
| 23 |
-
# Set up the PATH
|
| 24 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 25 |
|
| 26 |
-
# Copy
|
| 27 |
COPY --chown=user:user requirements.txt .
|
| 28 |
|
| 29 |
# Install dependencies
|
| 30 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 31 |
pip install --no-cache-dir -r requirements.txt
|
| 32 |
|
| 33 |
-
# Copy
|
| 34 |
COPY --chown=user:user . .
|
| 35 |
|
| 36 |
-
# Expose port 7860
|
| 37 |
EXPOSE 7860
|
| 38 |
|
| 39 |
# Command to run the application
|
| 40 |
-
# Note: Ensure your main file is named 'main.py' and the app instance is 'app'
|
| 41 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
|
|
|
|
|
| 5 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 6 |
PYTHONUNBUFFERED=1 \
|
|
|
|
| 7 |
HF_HOME=/app/.cache/huggingface
|
| 8 |
|
| 9 |
# Set the working directory
|
| 10 |
WORKDIR /app
|
| 11 |
|
| 12 |
+
# --- NEW: Install System Dependencies (Poppler) ---
|
| 13 |
+
# We update apt, install poppler-utils, and clean up to keep the image small
|
| 14 |
+
RUN apt-get update && apt-get install -y \
|
| 15 |
+
poppler-utils \
|
| 16 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 17 |
+
|
| 18 |
+
# Create a non-root user with a specific UID (1000)
|
| 19 |
RUN useradd -m -u 1000 user && \
|
| 20 |
chown -R user:user /app
|
| 21 |
|
| 22 |
# Switch to the non-root user
|
| 23 |
USER user
|
| 24 |
|
| 25 |
+
# Set up the PATH
|
| 26 |
ENV PATH="/home/user/.local/bin:$PATH"
|
| 27 |
|
| 28 |
+
# Copy requirements
|
| 29 |
COPY --chown=user:user requirements.txt .
|
| 30 |
|
| 31 |
# Install dependencies
|
| 32 |
RUN pip install --no-cache-dir --upgrade pip && \
|
| 33 |
pip install --no-cache-dir -r requirements.txt
|
| 34 |
|
| 35 |
+
# Copy application code
|
| 36 |
COPY --chown=user:user . .
|
| 37 |
|
| 38 |
+
# Expose port 7860
|
| 39 |
EXPOSE 7860
|
| 40 |
|
| 41 |
# Command to run the application
|
|
|
|
| 42 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|