-
-
Notifications
You must be signed in to change notification settings - Fork 289
/
Dockerfile.dev
40 lines (27 loc) · 918 Bytes
/
Dockerfile.dev
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# 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