# Sets the python version FROM python:3.9.5-slim # Allows the logs generated by python apps to be rendered in the terminal ENV PYTHONUNBUFFERED 1 # Sets the default shell to bash ENV SHELL /bin/bash # Creates a non-root user RUN adduser --disabled-password docker # Upgrades pip RUN pip install --upgrade pip # Poetry project setup for development # Copies poetry requirements files COPY --chown=docker Dockerfile.dev requirements.txt* setup.py* ./ RUN pip install -r requirements.txt RUN pip install pytest pytest-django codecov poetry # Clean up RUN apt-get autoremove -y \ && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* WORKDIR /home/docker # Sets the binaries to path ENV PATH="/home/docker/.local/bin:${PATH}" # Copy in as non-root user, so permissions match what we need COPY --chown=docker:docker . . RUN python setup.py develop # Applies the container user to be non-root USER docker