FROM python:3.11 # Create and switch to non-root user RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set working directory WORKDIR /app # Copy requirements and install COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the entire app COPY --chown=user . /app # Set the default command to run both populate_db and app CMD ["sh", "-c", "python populate_db.py && python run.py"]