Skip to content

Commit 67904d7

Browse files
committed
make poetry install match nautobot best practices
1 parent 532b7e3 commit 67904d7

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,25 @@ ARG PYTHON_VER=3.11
22

33
FROM python:${PYTHON_VER}-slim
44

5-
RUN which poetry || curl -sSL https://install.python-poetry.org | python3 - && \
6-
poetry config virtualenvs.create false
5+
# Install Poetry manually via its installer script;
6+
# if we instead used "pip install poetry" it would install its own dependencies globally which may conflict with ours.
7+
# https://python-poetry.org/docs/master/#installing-with-the-official-installer
8+
# This also makes it so that Poetry will *not* be included in the "final" image since it's not installed to /usr/local/
9+
ARG POETRY_HOME=/opt/poetry
10+
ARG POETRY_INSTALLER_PARALLEL=true
11+
ARG POETRY_VERSION=1.8.2
12+
ARG POETRY_VIRTUALENVS_CREATE=false
13+
ADD https://install.python-poetry.org /tmp/install-poetry.py
14+
RUN python /tmp/install-poetry.py
15+
16+
# Add poetry install location to the $PATH
17+
ENV PATH="${POETRY_HOME}/bin:${PATH}"
18+
19+
RUN poetry config virtualenvs.create ${POETRY_VIRTUALENVS_CREATE} && \
20+
poetry config installer.parallel "${POETRY_INSTALLER_PARALLEL}"
721

822
WORKDIR /local
923
COPY . /local
1024

1125
# Install the app
12-
RUN poetry install --extras all --with dev
26+
RUN poetry install --with dev

0 commit comments

Comments
 (0)