Spaces:
Sleeping
Sleeping
File size: 1,188 Bytes
64668f9 2f2e0cc d6fa8ab 2f2e0cc d6fa8ab dd12872 d6fa8ab 2f2e0cc 204f908 1095446 7db5dc9 204f908 1095446 64668f9 | 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 36 37 38 39 40 41 42 | # Start from a lightweight Python 3.10 image
FROM python:3.10-slim
# Set the working directory inside the container
WORKDIR /code
# Set up the paddlex directories
RUN mkdir /.paddlex
RUN chmod -R 775 /.paddlex
RUN mkdir /.paddlex/temp
RUN chmod -R 775 /.paddlex/temp
RUN mkdir /.paddlex/func_ret
RUN chmod -R 775 /.paddlex/func_ret
# Install ALL essential system dependencies for OpenCV & Paddle
# libgl1: Fixes libGL.so.1 (OpenGL/GPU-related)
# libglib2.0-0: Fixes libgthread-2.0.so.0 (GTK/GLib dependency)
# libgomp1: Fixes libgomp.so.1 (GNU OpenMP/Multi-threading)
# The other three ensure robust image handling.
RUN apt-get update && apt-get install -y \
libgl1 \
libglib2.0-0 \
libgomp1 \
libsm6 \
libxext6 \
libxrender-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file *first* to leverage Docker cache
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of your application code
COPY . .
# Expose the port your app will run on
EXPOSE 7860
# Command to run your FastAPI app with uvicorn
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |