-
Notifications
You must be signed in to change notification settings - Fork 9
/
Dockerfile
30 lines (21 loc) · 889 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
FROM python:3.9.6-buster as production
WORKDIR /app
RUN apt-get -y update && \
apt-get -y upgrade
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add && \
echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list && \
apt-get update && apt-get -y install postgresql-client-12
COPY pyproject.toml poetry.lock ./
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \
cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false
RUN poetry install --no-root --no-dev
COPY ./app ./
ENV LOG_LEVEL info
ENV PYTHONPATH=.
CMD [ "sh", "-c", "uvicorn app.main:app" ]
# For development build
FROM production as development
COPY ./tests ./tests
RUN poetry install --no-root