Spaces:
Sleeping
Sleeping
File size: 867 Bytes
4d10d86 80c4760 |
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 |
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# Install system dependencies for OpenCV and other packages
RUN apt-get update && apt-get install -y \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
libgomp1 \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file
COPY requirements.txt requirements.txt
# Install Python packages
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . /app
# Create a non-root user
RUN useradd -m -u 1000 user
# Change ownership
RUN chown -R user:user /app
# Switch to the non-root user
USER user
# Expose the port Gunicorn will run on (Using 7860 as in CMD)
EXPOSE 7860
# Command to run the app
CMD ["python", "app.py", "--host", "0.0.0.0", "--port", "7860"] |