File size: 983 Bytes
23f86bb 8a2129b ae3bfb2 af48e90 f879444 233c3f1 23f86bb ae3bfb2 23f86bb ae3bfb2 23f86bb ae3bfb2 23f86bb ae3bfb2 23f86bb ae3bfb2 233c3f1 f3612e7 ae3bfb2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# Use the correct Python version (3.10)
FROM python:3.10
# Install system dependencies including poppler-utils for pdf2image
RUN apt-get update && apt-get install -y \
build-essential \
libssl-dev \
ca-certificates \
libgl1 \
poppler-utils && \
rm -rf /var/lib/apt/lists/*
# Create a user for non-root operation
RUN useradd -m -u 1000 user
USER user
# Set the PATH to the user’s local bin directory
ENV PATH="/home/user/.local/bin:$PATH"
# Set the working directory to /app
WORKDIR /app
# Copy the requirements.txt and install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
# Ensure pip is up-to-date before installing requirements
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of the application code
COPY --chown=user . /app
# Expose the port and run the app with Uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|