Spaces:
Sleeping
Sleeping
| # Use the official Python 3.10 image from the Docker Hub | |
| FROM python:3.10.12 | |
| # 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 | |
| # Specify the command to run the application | |
| CMD ["python", "app.py"] | |