Spaces:
Sleeping
Sleeping
# Use Python 3.9 slim image as the base | |
FROM python:3.9-slim | |
# Set the working directory | |
WORKDIR /code | |
# Create a non-root user and switch to it | |
RUN groupadd -r myuser && useradd -r -g myuser myuser | |
# Copy and install Python dependencies | |
COPY requirements.txt /code/requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
# Switch to the non-root user | |
USER myuser | |
# Copy application code | |
COPY . /code | |
# Default command to run the application | |
CMD ["python", "app.py"] | |