-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
36 lines (29 loc) · 1.04 KB
/
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
FROM python:3.12-slim AS base
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y --no-install-recommends curl git build-essential \
&& apt-get autoremove -y
ENV POETRY_HOME="/opt/poetry"
ENV PATH="$POETRY_HOME/bin:$PATH"
RUN curl -sSL https://install.python-poetry.org | python3 -
FROM base AS install
WORKDIR /home/code
# allow controlling the poetry installation of dependencies via external args
ARG INSTALL_ARGS="--no-root --only main"
COPY pyproject.toml poetry.lock ./
# install without virtualenv, since we are inside a container
RUN poetry config virtualenvs.create false \
&& poetry install $INSTALL_ARGS
# cleanup
RUN curl -sSL https://install.python-poetry.org | python3 - --uninstall
RUN apt-get purge -y curl git build-essential \
&& apt-get clean -y \
&& rm -rf /root/.cache \
&& rm -rf /var/apt/lists/* \
&& rm -rf /var/cache/apt/*
FROM install AS app-image
ENV PYTHONPATH=/home/code/ PYTHONHASHSEED=0
COPY app/ app/
COPY alembic/ alembic/
COPY tests/ tests/
COPY alembic.ini config.ini ./