nemaquant / Dockerfile
sloneckity's picture
Add OpenCV system dependencies to Dockerfile
4b664ae
raw
history blame
1.55 kB
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /app
# Install system dependencies required by OpenCV and other packages
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxrender1 \
libxext6 \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file into the container at /app
COPY requirements.txt .
# Install any needed packages specified in requirements.txt
# --no-cache-dir: Disables the cache to reduce image size.
# -r requirements.txt: Specifies the file containing the list of packages to install.
RUN pip install --no-cache-dir -r requirements.txt
# Create directories for uploads and results, and set permissions
RUN mkdir -p /app/uploads /app/results && \
chmod 777 /app/uploads /app/results
# Copy the rest of the application code into the container at /app
# This includes app.py, nemaquant.py, templates/, static/, etc.
COPY . .
# Make port 7860 available to the world outside this container
# This is the port Flask will run on (as configured in app.py)
# Hugging Face Spaces typically uses this port
EXPOSE 7860
# Define environment variables (optional, can be useful)
# ENV NAME=World
# Run app.py when the container launches
# Use gunicorn for production deployment if preferred over Flask's development server
# CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"]
# For simplicity during development and typical HF Spaces use:
CMD ["python", "app.py"]