# Base image FROM python:3.9-slim # Create and switch to a non-root user RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory inside the container WORKDIR /app # Copy necessary files into the container with ownership set to the user COPY --chown=user requirements.txt requirements.txt COPY --chown=user app.py app.py COPY --chown=user model model COPY --chown=user Dataset Dataset COPY --chown=user templates templates COPY --chown=user static static COPY --chown=user Utility Utility # Install dependencies RUN pip install --no-cache-dir --upgrade -r requirements.txt # Expose the required port EXPOSE 5000 # Set the default command to run the Flask app CMD ["python", "app.py"]