diff --git a/docker/build_base/Dockerfile b/docker/build_base/Dockerfile index 0744ac559..5ff3ca700 100644 --- a/docker/build_base/Dockerfile +++ b/docker/build_base/Dockerfile @@ -3,6 +3,9 @@ FROM fedora:35 AS base +ARG spdk_repo=/tmp/spdk_repo +ARG spdk_tar=/spdk.tar.gz + # Generic args ARG PROXY ARG NO_PROXY @@ -12,8 +15,31 @@ ENV https_proxy=$PROXY ENV no_proxy=$NO_PROXY COPY --chown=root:root spdk.tar.gz /spdk.tar.gz -COPY pre-install /install -RUN /install +RUN if [[ ! -e $spdk_tar ]]; then printf 'Missing %s\n' "$spdk_tar" >&2; exit 1; fi +RUN mkdir -p "$spdk_repo" && \ + tar -C "$spdk_repo" -xf "$spdk_tar" && \ + chown -R root:root "$spdk_repo" +RUN dnf install -y rpm-build +RUN "$spdk_repo/scripts/pkgdep.sh" -d +RUN "$spdk_repo/test/common/config/vm_setup.sh" --test-conf=fio + +# HACK: In case we received a .tar with built SPDK we need to overwrite the +# configuration to update all the paths make would need to lookup - this is +# needed since we execute inside a different mount namespace so we won't be +# able to find any absolute paths that were used prior creating the .tar. +RUN "$spdk_repo/configure" +RUN DEPS="no" "$spdk_repo/rpmbuild/rpm.sh" \ + --with-shared \ + --with-virtio \ + --with-fio +RUN mv "$HOME/rpmbuild/rpm/x86_64/"*.rpm /tmp +RUN mv "/usr/src/fio/fio" /tmp + +# Clean things up +RUN rm -f "$HOME/rpmbuild/rpm/x86_64/"*.rpm +RUN rm -f "$spdk_tar" +RUN rm -rf "$spdk_repo" +RUN dnf clean all # We are doing a multi-stage build here. This means that previous image, # base, is going to end up as an intermediate one, untagged, - this diff --git a/docker/build_base/pre-install b/docker/build_base/pre-install deleted file mode 100755 index 240d34c9e..000000000 --- a/docker/build_base/pre-install +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash -set -e - -spdk_repo=$(mktemp -dt "spdk.XXXXXX") -spdk_tar=/spdk.tar.gz - -cleanup() { - - rm -f "$HOME/rpmbuild/rpm/x86_64/"*.rpm - rm -f "$spdk_tar" - rm -rf "$spdk_repo" -} - -trap 'cleanup' EXIT - -if [[ ! -e $spdk_tar ]]; then - printf 'Missing %s\n' "$spdk_tar" >&2 - exit 1 -fi - -tar -C "$spdk_repo" -xf "$spdk_tar" -chown -R root:root "$spdk_repo" - -# Required for building RPM -dnf install -y rpm-build - -# Spice it a bit with supported sources -"$spdk_repo/scripts/pkgdep.sh" -d -"$spdk_repo/test/common/config/vm_setup.sh" --test-conf=fio - -# HACK: In case we received a .tar with built SPDK we need to overwrite the -# configuration to update all the paths make would need to lookup - this is -# needed since we execute inside a different mount namespace so we won't be -# able to find any absolute paths that were used prior creating the .tar. -"$spdk_repo/configure" > /dev/null - -# Deploy SPDK inside the container -DEPS="no" "$spdk_repo/rpmbuild/rpm.sh" \ - --with-shared \ - --with-virtio \ - --with-fio - -mv "$HOME/rpmbuild/rpm/x86_64/"*.rpm /tmp -mv "/usr/src/fio/fio" /tmp -dnf clean all