Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker | |
# you will also find guides on how best to write your Dockerfile | |
FROM python:3.10 | |
# Install required system dependencies for OpenCV | |
RUN apt-get update && apt-get install -y \ | |
libgl1-mesa-glx \ | |
libglib2.0-0 \ | |
libsm6 \ | |
libxext6 \ | |
libxrender-dev \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Create a non-root user to run the app | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV PATH="/home/user/.local/bin:$PATH" | |
# Set the working directory | |
WORKDIR /app | |
# Copy the requirements file and install dependencies | |
COPY --chown=user ./requirements.txt requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application code | |
COPY --chown=user . /app | |
# Set the command to start the application | |
CMD ["gunicorn", "-b", "0.0.0.0:7860", "-k", "eventlet", "app:app"] | |