-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (27 loc) · 975 Bytes
/
Dockerfile
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
# Sets the python version
FROM python:3.9.4-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
RUN apt-get update
# Upgrades pip
RUN pip install --upgrade pip
# Poetry project setup for development
# Copies poetry requirements files
COPY --chown=docker Dockerfile poetry.lock* pyproject.toml* ./
RUN pip install poetry \
&& poetry config virtualenvs.create false --local
# && test -f pyproject.toml && poetry install
RUN test -f pyproject.toml && poetry install || echo " pyproject.toml does not exist"
# 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 . .