Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files1234567891011123456789101112131415161718192021222324252627281213141516171819202122232425262728293031323334353637383940# Use an official Python runtime as a parent imageFROM python:3.10-slim
# Set the working directory in the containerWORKDIR /app
# Install system dependencies for OpenCV and other packagesRUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libglib2.0-0 \ libsm6 \# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# 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
libxext6 \ libxrender-dev \ libgomp1 \ libgthread-2.0-0 \ && rm -rf /var/lib/apt/lists/*
# Copy the requirements fileCOPY requirements.txt requirements.txt
# Install Python packagesRUN pip install --no-cache-dir -r requirements.txt
# Copy application codeCOPY . /app
# Create a non-root userRUN useradd -m -u 1000 user
# Change ownershipRUN chown -R user:user /app
# Switch to the non-root userUSER user
# Expose the port Gunicorn will run on (Using 7860 as in CMD)EXPOSE 7860
# Command to run the appCMD ["python", "app.py", "--host", "0.0.0.0", "--port", "7860"]Dockerfile+39-28