Spaces:
Sleeping
Sleeping
| # Use the official Python 3.9 image from the Docker Hub | |
| FROM python:3.9 | |
| # Create a new user with the username 'user' and a user ID of 1000 | |
| RUN useradd -m -u 1000 user | |
| # Switch to the new user | |
| USER user | |
| # Set an environment variable to add the local bin directory to the PATH | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set the working directory inside the container to /app | |
| WORKDIR /app | |
| # Copy the requirements.txt file into the container, changing ownership to 'user' | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| # Install the dependencies listed in requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy the rest of the application code into the container, changing ownership to 'user' | |
| COPY --chown=user . /app | |
| # Set the Flask environment variables | |
| ENV FLASK_APP=app.py | |
| ENV FLASK_RUN_HOST=0.0.0.0 | |
| ENV FLASK_RUN_PORT=7860 | |
| # Specify the command to run the Flask application | |
| CMD ["flask", "run"] | |