# Use an official Python runtime as a parent image FROM python:3.9 # Create a user to run the app RUN useradd -m -u 1000 user USER user ENV PATH="/home/user/.local/bin:$PATH" # Set the working directory in the container WORKDIR /app # Copy the requirements file and install dependencies COPY --chown=user ./requirements.txt requirements.txt RUN pip install --no-cache-dir --upgrade -r requirements.txt # Copy the current directory contents into the container at /app COPY --chown=user . /app # Initialize the database RUN python - <