-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
Dockerfile
45 lines (31 loc) · 983 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
40
41
42
43
44
45
FROM python:3.11-slim AS builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
gcc \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
ENV \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
#
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
#
POETRY_VERSION="1.8.2" \
POETRY_HOME="/src/package/" \
POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=true \
#
POETRY_VENV="/src/package/.venv"
ENV PATH="$POETRY_HOME/bin:$POETRY_VENV/bin:$PATH"
WORKDIR /src
RUN python -m pip install poetry
COPY python-package/pyproject.toml python-package/poetry.lock /src/package/
RUN cd /src/package/ && poetry install --no-root --without=dev --all-extras
FROM builder AS final
COPY python-package /src/package/
COPY --from=builder $POETRY_HOME $POETRY_HOME
COPY --from=builder $POETRY_VENV $POETRY_VENV
RUN cd /src/package/ && poetry install --with=docs
WORKDIR /src/docs
CMD mkdocs serve --dev-addr=0.0.0.0:8000