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: Karol Latecki <karol.latecki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14158 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Boris Glimcher <Boris.Glimcher@emc.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Pawel Piatek <pawelx.piatek@intel.com> Reviewed-by: Michal Berger <michal.berger@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
ba453fbecf
commit
602a900006
@ -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
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user