Spaces:
Sleeping
Sleeping
| # Use an official Python runtime as a parent image | |
| FROM python:3.9 | |
| # Set up non-root user | |
| RUN useradd -m -u 1000 user | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the current directory contents into the container at /app | |
| COPY ./requirements.txt requirements.txt | |
| # Install system dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y \ | |
| libgl1-mesa-glx \ | |
| libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Switch to non-root user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Copy the rest of the application code | |
| COPY . /app | |
| # Define environment variable for Flask | |
| ENV FLASK_APP=app.py | |
| # Run the Flask application | |
| CMD ["flask", "run", "--host", "0.0.0.0", "--port", "7860"] | |