Commit 602a9000 authored by Karol Latecki's avatar Karol Latecki Committed by Jim Harris
Browse files

docker: remove pre-install script



Remove "pre-install" script used for building
"build_base" image and move it's content into
Dockerfile. This results in resulting more build
layers, but makes rebuilding easier. We can now
rebuild or update the image starting at some later
cached layer instead of starting pre-install from
scratch every time.

Change-Id: I78b46cda4bb815ac8cf72c8251a3cc585b373acc
Signed-off-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14158


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBoris Glimcher <Boris.Glimcher@emc.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarPawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent ba453fbe
Loading
Loading
Loading
Loading
+28 −2
Original line number Diff line number Diff line
@@ -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, <none> - this

docker/build_base/pre-install

deleted100755 → 0
+0 −45
Original line number Diff line number Diff line
#!/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