From 040d316f54c80074a5ed9d4516b56dc3fa04a223 Mon Sep 17 00:00:00 2001 From: Yuming Zhu Date: Oct 21 2024 13:53:36 +0000 Subject: update Dockerfiles for devcontainer --- diff --git a/devtools/containers/Dockerfile.centos7 b/devtools/containers/Dockerfile.centos7 index 35ef358..6f9776f 100644 --- a/devtools/containers/Dockerfile.centos7 +++ b/devtools/containers/Dockerfile.centos7 @@ -1,5 +1,9 @@ FROM quay.io/centos/centos:7 +ARG EXTRA_PKGS RUN \ + sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/CentOS-*.repo && \ + sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/CentOS-*.repo && \ + sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/CentOS-*.repo && \ yum -y update && \ yum install -y \ dnf \ @@ -15,7 +19,10 @@ RUN \ yum install -y \ python-defusedxml \ python-pip \ - python-psycopg2 && \ + python-psycopg2 \ + ${EXTRA_PKGS} && \ yum clean all && \ - pip install -U 'pip==9.0.1' && \ + pip install -U 'pip==9.0.3' \ + --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org \ + --upgrade && \ pip install -U tox diff --git a/devtools/containers/Dockerfile.centos8 b/devtools/containers/Dockerfile.centos8 index 5962967..0e97da6 100644 --- a/devtools/containers/Dockerfile.centos8 +++ b/devtools/containers/Dockerfile.centos8 @@ -1,5 +1,5 @@ FROM quay.io/centos/centos:stream8 - +ARG EXTRA_PKGS RUN \ dnf -y update --nodocs --setopt=install_weak_deps=False && \ dnf install -y --nodocs --setopt=install_weak_deps=False epel-release && \ @@ -11,5 +11,5 @@ RUN \ python3-devel \ python3-librepo \ python3-tox \ - rpm-build && \ + ${EXTRA_PKGS} && \ dnf clean all diff --git a/devtools/containers/Dockerfile.centos9 b/devtools/containers/Dockerfile.centos9 index 7135a64..d659ffe 100644 --- a/devtools/containers/Dockerfile.centos9 +++ b/devtools/containers/Dockerfile.centos9 @@ -1,5 +1,5 @@ FROM quay.io/centos/centos:stream9 - +ARG EXTRA_PKGS RUN \ dnf -y update --nodocs --setopt=install_weak_deps=False && \ dnf install -y --nodocs --setopt=install_weak_deps=False epel-release && \ @@ -11,5 +11,5 @@ RUN \ python3-devel \ python3-librepo \ python3-tox \ - rpm-build && \ + ${EXTRA_PKGS} && \ dnf clean all diff --git a/devtools/containers/Dockerfile.f39 b/devtools/containers/Dockerfile.f39 index fdd84c7..d83a96f 100644 --- a/devtools/containers/Dockerfile.f39 +++ b/devtools/containers/Dockerfile.f39 @@ -1,4 +1,5 @@ FROM registry.fedoraproject.org/fedora:39 +ARG EXTRA_PKGS RUN \ dnf -y update --nodocs --setopt=install_weak_deps=False && \ dnf install -y --nodocs --setopt=install_weak_deps=False \ @@ -9,5 +10,6 @@ RUN \ python3-devel \ python3-librepo \ python3-tox \ - rpm-build && \ + rpm-build \ + ${EXTRA_PKGS} && \ dnf clean all diff --git a/devtools/containers/Dockerfile.rawhide b/devtools/containers/Dockerfile.rawhide index 3f907c6..102f1f2 100644 --- a/devtools/containers/Dockerfile.rawhide +++ b/devtools/containers/Dockerfile.rawhide @@ -1,4 +1,5 @@ FROM registry.fedoraproject.org/fedora:rawhide +ARG EXTRA_PKGS RUN \ dnf -y update --nodocs --setopt=install_weak_deps=False && \ dnf install -y --nodocs --setopt=install_weak_deps=False \ @@ -9,5 +10,6 @@ RUN \ python3-devel \ python3-librepo \ python3-tox \ - rpm-build && \ + rpm-build \ + ${EXTRA_PKGS} && \ dnf clean all diff --git a/devtools/containers/README.md b/devtools/containers/README.md index dabb0d0..59c0df4 100644 --- a/devtools/containers/README.md +++ b/devtools/containers/README.md @@ -27,10 +27,14 @@ Or CentOS with py3 as an example: Or CentOS with py2 as an example: - docker build -t koji_test_centos:7 --no-cache -f Dockerfile.centos8 + docker build -t koji_test_centos:7 --no-cache -f Dockerfile.centos7 docker run --rm -v $PWD:/koji --name koji_test koji_test_centos:7 bash -c "cd /koji && tox -e py2" When running with Podman and SELinux enabled, use the "--security-opt label=disable" option: podman run --rm -v $PWD:/koji --security-opt label=disable --name koji_test koji_test_fedora:39 bash -c "cd /koji && ls -l /koji && tox -e flake8,py3,bandit" + +One build argument - `EXTRA_PKGS` is provided to install custom packages while building images (for CentOS* and Fedora 39+), like: + + docker build --build-arg EXTRA_PKGS="git make" -t koji_test_centos:7 --no-cache -f Dockerfile.centos7