Skip to content

Commit

Permalink
fix(build): use manual installation for python Poetry
Browse files Browse the repository at this point in the history
The Docker image, `python:3.11-slim`, that CourtListener are
built from, recently stopped working with the installation
script that is downloaded and executed for the Poetry tool:

```
RUN curl -sSL https://install.python-poetry.org | python3 -
```

Instead of this script, use the installation with `pip` that
is a alternative approach which doesn't have this problem and
is more direct than the script.

Fixes: #3079
  • Loading branch information
cweider committed Sep 6, 2023
1 parent 1e94c4a commit cb29bec
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions docker/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,19 @@ ENV POETRY_VERSION=1.6.1 \
# do not ask any interactive question
POETRY_NO_INTERACTION=1

# install poetry - respects $POETRY_VERSION & $POETRY_HOME
RUN curl -sSL https://install.python-poetry.org | python3 -

ENV PYTHONUNBUFFERED=1 \
# this is where our requirements will be loaded
# this is where our requirements are copied to
PYSETUP_PATH="/opt/pysetup"

# prepend poetry and venv to path
ENV PATH="/opt/poetry/bin:$PATH"

RUN python -m venv $POETRY_HOME && \
$POETRY_HOME/bin/pip install poetry==$POETRY_VERSION --quiet --upgrade

FROM build-base as build-dev

WORKDIR $PYSETUP_PATH

COPY poetry.lock pyproject.toml ./
RUN poetry install --no-root
RUN $POETRY_HOME/bin/poetry install --no-root

COPY . /opt/courtlistener

Expand All @@ -62,7 +58,7 @@ ADD https://raw.githubusercontent.com/freelawproject/courtlistener/main/poetry.l
ADD https://raw.githubusercontent.com/freelawproject/courtlistener/main/pyproject.toml /opt/pyproject.toml

# install runtime deps - uses $POETRY_VIRTUALENVS_IN_PROJECT internally
RUN poetry install --no-root --without dev
RUN $POETRY_HOME/bin/poetry install --no-root --without dev

ADD https://github.com/freelawproject/courtlistener/archive/main.tar.gz /opt/courtlistener.tar.gz
WORKDIR /opt
Expand Down

0 comments on commit cb29bec

Please sign in to comment.