Skip to content

Commit

Permalink
Fix installing dependencies
Browse files Browse the repository at this point in the history
Python package fedora-messaging must be installed for Fedora.

Complicated pip-compile dependency management is replaced with simple
"requirements.txt" which updates pip and required build dependencies.
Poetry is installed using the official way (the version is not pinned;
it is also not included in the final image).
  • Loading branch information
hluk committed May 10, 2022
1 parent a475dd2 commit 6cce348
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 325 deletions.
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
FROM registry.access.redhat.com/ubi8/ubi:8.5 as builder

# hadolint ignore=DL3033
RUN set -ex \
# hadolint ignore=DL3033,DL4006,SC3040
RUN set -exo pipefail \
&& mkdir -p /mnt/rootfs \
# install builder dependencies
&& yum install -y \
--setopt install_weak_deps=false \
--nodocs \
python39 \
python39-pip \
# install runtime dependencies
&& yum install -y \
--installroot=/mnt/rootfs \
--releasever=8 \
Expand All @@ -17,7 +18,10 @@ RUN set -ex \
libstdc++ \
python39 \
&& yum --installroot=/mnt/rootfs clean all \
&& rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.*
&& rm -rf /mnt/rootfs/var/cache/* /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* \
# https://python-poetry.org/docs/master/#installing-with-the-official-installer
&& curl -sSL https://install.python-poetry.org | python3 - \
&& python3 -m venv /venv

ARG GITHUB_REF
ARG GITHUB_SHA
Expand All @@ -36,14 +40,13 @@ WORKDIR /build
COPY . .
# hadolint ignore=SC1091
RUN set -ex \
&& pip3 install --no-cache-dir -r requirements-builder.txt \
&& python3 -m venv /venv \
&& export PATH=/root/.local/bin:$PATH \
&& . /venv/bin/activate \
&& pip install --no-cache-dir -r requirements-builder2.txt \
&& version=$(./get-version.sh) \
&& test -n "$version" \
&& poetry version "$version" \
&& poetry build \
&& pip install --no-cache-dir -r requirements.txt \
&& poetry build --format=wheel \
&& pip install --no-cache-dir dist/greenwave-"$version"-py3*.whl \
&& deactivate \
&& mv /venv /mnt/rootfs \
Expand Down
38 changes: 19 additions & 19 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ python-memcached = "^1.59"
prometheus-client = "^0.14.1"
requests = "^2.26.0"
python-dateutil = "^2.8.2"
cryptography = {version = "^37.0.2", optional = true}
fedora-messaging = "^2.1.0"

# latest versions of stomp.py 8.0.0 and 8.0.1 are causing connection issues
"stomp.py" = "7.0.0"
Expand All @@ -47,7 +47,6 @@ pytest-cov = {version = "^3.0.0", optional = true}
mock = {version = "^4.0.3", optional = true}

SQLAlchemy = {version = "^1.4.36", optional = true}
fedora-messaging = {version = "^2.1.0", optional = true}
psycopg2-binary = {version = "^2.9.3", optional = true}

sphinx = {version = "^4.0.2", optional = true}
Expand All @@ -59,7 +58,6 @@ test = [
"pytest",
"pytest-cov",
"mock",
"fedora-messaging",
]
functional-test = [
"SQLAlchemy",
Expand Down
1 change: 0 additions & 1 deletion requirements-builder.in

This file was deleted.

0 comments on commit 6cce348

Please sign in to comment.