Spaces:
Runtime error
Runtime error
| # Use the official Python image from the Docker Hub | |
| FROM python:3.9 | |
| # Create a non-root user and switch to it | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Set the PATH to include user's local binary directory | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements.txt and install dependencies as the user | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the application code into the container as the user | |
| COPY --chown=user . /app | |
| # Command to run the Flask app using Python | |
| CMD ["python", "app.py"] | |