Skip to content

Commit

Permalink
refactor(docker): Swap two RUN statements in pythonbuild
Browse files Browse the repository at this point in the history
The installation of ScanCode's requirements installs the packaging
package version 21.3, see [1]. However, the recent Poetry versions
(`>= 1.8.0`) require a packaging version `>= 22.0`, see [2]. If that
isn't met, Poetry fails with [3].

Simply swap the `RUN` statements, so that the installation of
ScanCode's requirement does not downgrade the packaging package, as a
preparation for updating Poetry.

[1]: https://github.com/nexB/scancode-toolkit/blob/4f49985c26b6b8f951f116dfa3fe39ce27bd4ce8/requirements.txt#L44.
[2]: python-poetry/poetry#9029 (comment)
[3]: `No module named 'packaging.metadata'`

Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau authored and sschuberth committed May 27, 2024
1 parent 5f034b4 commit 2693bba
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ ARG PYTHON_POETRY_VERSION
ARG PIPTOOL_VERSION
ARG SCANCODE_VERSION

RUN ARCH=$(arch | sed s/aarch64/arm64/) \
&& if [ "$ARCH" == "arm64" ]; then \
pip install -U scancode-toolkit-mini==$SCANCODE_VERSION; \
else \
curl -Os https://raw.githubusercontent.com/nexB/scancode-toolkit/v$SCANCODE_VERSION/requirements.txt; \
pip install -U --constraint requirements.txt scancode-toolkit==$SCANCODE_VERSION; \
rm requirements.txt; \
fi

RUN pip install --no-cache-dir -U \
pip=="$PIPTOOL_VERSION" \
wheel \
Expand All @@ -163,15 +172,6 @@ RUN pip install --no-cache-dir -U \
poetry=="$PYTHON_POETRY_VERSION" \
python-inspector=="$PYTHON_INSPECTOR_VERSION"

RUN ARCH=$(arch | sed s/aarch64/arm64/) \
&& if [ "$ARCH" == "arm64" ]; then \
pip install -U scancode-toolkit-mini==$SCANCODE_VERSION; \
else \
curl -Os https://raw.githubusercontent.com/nexB/scancode-toolkit/v$SCANCODE_VERSION/requirements.txt; \
pip install -U --constraint requirements.txt scancode-toolkit==$SCANCODE_VERSION; \
rm requirements.txt; \
fi

FROM scratch AS python
COPY --from=pythonbuild /opt/python /opt/python

Expand Down

0 comments on commit 2693bba

Please sign in to comment.