Spaces:
Sleeping
Sleeping
| # 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.9 | |
| # Create a non-root user with UID 1000 for security | |
| RUN useradd -m -u 1000 user | |
| # Switch to the non-root user | |
| USER user | |
| # Add user's local bin to PATH | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy the requirements file with proper ownership | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the application code with proper ownership | |
| COPY --chown=user . /app | |
| # Expose the port that Hugging Face Spaces expects | |
| EXPOSE 7860 | |
| # Command to run the Flask application on port 7860 | |
| CMD ["python", "app.py"] | |