diff --git a/Dockerfile.IntelP4.rhel b/Dockerfile.IntelP4.rhel index fa4d500ad..ea8350d9d 100644 --- a/Dockerfile.IntelP4.rhel +++ b/Dockerfile.IntelP4.rhel @@ -12,7 +12,7 @@ WORKDIR /src RUN dnf install -y \ kmod \ gettext \ - python3-pip \ + python3-devel \ pciutils \ libnl3 \ libedit \ @@ -20,26 +20,23 @@ RUN dnf install -y \ libatomic \ libconfig \ gcc gcc-c++ \ - && dnf clean all + && dnf clean all \ + && python3 -m ensurepip --upgrade RUN mkdir -p /opt/${P4_NAME} COPY cmd/intelvsp/$P4_NAME/* /opt/${P4_NAME}/ COPY cmd/intelvsp/p4sdk/entrypoint.sh / COPY cmd/intelvsp/p4sdk/es2k_skip_p4.conf.template / - -RUN python3 -m pip install --no-cache-dir \ - netaddr==1.2.1 - WORKDIR / # Add steps for cachito ENV REMOTE_SOURCES=${REMOTE_SOURCES:-"./openshift/"} ENV REMOTE_SOURCES_DIR=${REMOTE_SOURCES_DIR:-"/cachito"} COPY ${REMOTE_SOURCES} ${REMOTE_SOURCES_DIR} -COPY openshift/install-dpu.sh . -RUN chmod +x install-dpu.sh \ - && ./install-dpu.sh +COPY openshift/install-dpu-p4.sh . +RUN chmod +x install-dpu-p4.sh \ + && ./install-dpu-p4.sh # Remove packages which are only needed for cachito RUN dnf remove -y gcc gcc-c++ \ diff --git a/openshift/install-dpu-p4.sh b/openshift/install-dpu-p4.sh new file mode 100644 index 000000000..53a7e1c92 --- /dev/null +++ b/openshift/install-dpu-p4.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -euo pipefail + +PIP_OPTS="--no-cache-dir" +# Check if we are building the image in the OSBS environment. If so, source the +# env vars specific for enabling cachito. +if [ -d ${REMOTE_SOURCES_DIR}/cachito-gomod-with-deps ]; then + source ${REMOTE_SOURCES_DIR}/cachito-gomod-with-deps/cachito.env + cd ${REMOTE_SOURCES_DIR}/cachito-gomod-with-deps/app/openshift + export GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS=16 +else + cd ${REMOTE_SOURCES_DIR} +fi + +python3 -m pip install --upgrade pip + +# Install the packages in order of build dependency to avoid issues during installation. +python3 -m pip install ${PIP_OPTS} -r requirements-p4.txt + +rm -rf ${REMOTE_SOURCES_DIR} diff --git a/openshift/requirements-p4.txt b/openshift/requirements-p4.txt new file mode 100644 index 000000000..c8e779f9d --- /dev/null +++ b/openshift/requirements-p4.txt @@ -0,0 +1 @@ +netaddr==1.2.1