From ecf7da7aa3dd70265bb2c14029ddd1e6f755e868 Mon Sep 17 00:00:00 2001 From: Mike Bonnet Date: Aug 24 2022 19:03:08 +0000 Subject: install mbs in the container images using pip Removing the requirement to build the rpm as part of the image build simplifies the build process and reduces fragility introduced by trying to keep the rpm build and image builds in sync. --- diff --git a/openshift/backend/Dockerfile b/openshift/backend/Dockerfile index 46e53e1..8a32f19 100644 --- a/openshift/backend/Dockerfile +++ b/openshift/backend/Dockerfile @@ -1,54 +1,70 @@ -FROM fedora:31 AS builder +FROM registry.fedoraproject.org/fedora:latest AS builder -ARG EXTRA_RPMS="" -ARG GIT_REPO="" -ARG GIT_REF="" -ARG VERSION="" -ARG CREATED="" ARG DNF_CMD="dnf -y --setopt=deltarpm=0 --setopt=install_weak_deps=false --setopt=tsflags=nodocs" COPY . /src WORKDIR /src -RUN ${DNF_CMD} install \ - 'dnf-command(builddep)' rpm-build rpmdevtools rpmlint \ - python3-tox python3-pytest python3-pytest-cov python3-mock python3-flake8 bandit && \ - ${DNF_CMD} builddep *.spec && \ - ${DNF_CMD} clean all -RUN rpmdev-setuptree && \ - python3 setup.py sdist && \ - rpmbuild --define "_sourcedir $PWD/dist" -ba *.spec && \ - mv $HOME/rpmbuild/RPMS /srv -RUN flake8 && \ - bandit -r -ll -s B102,B104,B303,B411,B602 module_build_service && \ - tox -v -e py3 - - -FROM fedora:31 +RUN $DNF_CMD install \ + python3-setuptools python3-wheel && \ + $DNF_CMD clean all +RUN python3 setup.py bdist_wheel -u root -g root + +FROM registry.fedoraproject.org/fedora:latest + +ARG DNF_CMD="dnf -y --setopt=deltarpm=0 --setopt=install_weak_deps=false --setopt=tsflags=nodocs" +ARG EXTRA_RPMS="" + LABEL \ org.opencontainers.image.title="Backend for the Module Build Service (MBS)" \ org.opencontainers.image.description="The MBS coordinates module builds. This image is to serve as the MBS backend." \ - org.opencontainers.image.vendor="The Factory 2.0 Team" \ - org.opencontainers.image.authors="The Factory 2.0 Team " \ + org.opencontainers.image.vendor="The Brew Guild" \ + org.opencontainers.image.authors="The Brew Guild " \ org.opencontainers.image.licenses="MIT" \ - org.opencontainers.image.source="$GIT_REPO" \ - org.opencontainers.image.revision="$GIT_REF" \ - org.opencontainers.image.version="$VERSION" \ - org.opencontainers.image.created="$CREATED" \ org.opencontainers.image.url="https://pagure.io/fm-orchestrator" \ org.opencontainers.image.documentation="https://pagure.io/fm-orchestrator" \ distribution-scope="public" -COPY --from=builder /srv/RPMS /srv/RPMS -COPY repos/ /etc/yum.repos.d/ +COPY --from=builder /src/dist /src/dist RUN $DNF_CMD install \ + python3-celery \ + python3-distro \ + python3-dnf \ + python3-docopt \ + python3-dogpile-cache \ + python3-fedmsg \ + python3-flask \ + python3-flask-migrate \ + python3-flask-sqlalchemy \ + python3-kobo \ + python3-kobo-rpmlib \ + python3-koji \ + python3-ldap3 \ + python3-libmodulemd \ + python3-m2crypto \ + python3-moksha-hub \ + python3-munch \ + python3-openidc-client \ + python3-packaging \ + python3-pip \ + python3-prometheus_client \ python3-psycopg2 \ + python3-pungi \ + python3-pyOpenSSL \ + python3-pyparsing \ + python3-requests \ python3-service-identity \ - /srv/*/*/*.rpm \ + python3-six \ + python3-solv \ + python3-sqlalchemy \ + git-core \ $EXTRA_RPMS && \ - $DNF_CMD clean all && \ - rm -rf /srv/RPMS + rm -f /etc/fedmsg.d/* && \ + $DNF_CMD clean all +# Install locally available python wheels only. +# Any new/updated dependencies should be installed via rpm. +RUN pip-3 install --no-deps /src/dist/*.whl USER 1001 diff --git a/openshift/frontend/Dockerfile b/openshift/frontend/Dockerfile index 3e80d5d..04e68b8 100644 --- a/openshift/frontend/Dockerfile +++ b/openshift/frontend/Dockerfile @@ -1,22 +1,14 @@ # See `../backend/` for building `mbs-backend:latest` FROM mbs-backend:latest -ARG GIT_REPO="" -ARG GIT_REF="" -ARG VERSION="" -ARG CREATED="" ARG DNF_CMD="dnf -y --setopt=deltarpm=0 --setopt=install_weak_deps=false --setopt=tsflags=nodocs" LABEL \ org.opencontainers.image.title="Frontend for the Module Build Service (MBS)" \ org.opencontainers.image.description="The MBS coordinates module builds. This image is to serve as the MBS frontend." \ - org.opencontainers.image.vendor="The Factory 2.0 Team" \ - org.opencontainers.image.authors="The Factory 2.0 Team " \ + org.opencontainers.image.vendor="The Brew Guild" \ + org.opencontainers.image.authors="The Brew Guild " \ org.opencontainers.image.licenses="MIT" \ - org.opencontainers.image.source="$GIT_REPO" \ - org.opencontainers.image.revision="$GIT_REF" \ - org.opencontainers.image.version="$VERSION" \ - org.opencontainers.image.created="$CREATED" \ org.opencontainers.image.url="https://pagure.io/fm-orchestrator" \ org.opencontainers.image.documentation="https://pagure.io/fm-orchestrator" \ io.openshift.expose-services="8080:http,8443:https" \