xref: /spdk/docker/build_base/Dockerfile (revision a6dbe3721eb3b5990707fc3e378c95e505dd8ab5)
1# SPDX-License-Identifier: Apache-2.0
2# Copyright (C) 2021 Intel Corporation
3#
4
5FROM fedora:35 AS base
6
7ARG spdk_repo=/tmp/spdk_repo
8ARG spdk_tar=/spdk.tar.gz
9
10# Generic args
11ARG PROXY
12ARG NO_PROXY
13
14ENV http_proxy=$PROXY
15ENV https_proxy=$PROXY
16ENV no_proxy=$NO_PROXY
17
18COPY --chown=root:root spdk.tar.gz /spdk.tar.gz
19RUN if [[ ! -e $spdk_tar ]]; then printf 'Missing %s\n' "$spdk_tar" >&2; exit 1; fi
20RUN mkdir -p "$spdk_repo" && \
21	tar -C "$spdk_repo" -xf "$spdk_tar" && \
22	chown -R root:root "$spdk_repo"
23RUN dnf install -y rpm-build
24RUN "$spdk_repo/scripts/pkgdep.sh" -d
25RUN "$spdk_repo/test/common/config/vm_setup.sh" --test-conf=fio
26
27# HACK: In case we received a .tar with built SPDK we need to overwrite the
28# configuration to update all the paths make would need to lookup - this is
29# needed since we execute inside a different mount namespace so we won't be
30# able to find any absolute paths that were used prior creating the .tar.
31RUN "$spdk_repo/configure"
32RUN DEPS="no" "$spdk_repo/rpmbuild/rpm.sh" \
33	--with-shared \
34	--with-virtio \
35	--with-fio
36RUN mv "$HOME/rpmbuild/rpm/$(uname -m)/"*.rpm /tmp
37RUN mv "/usr/src/fio/fio" /tmp
38
39# Clean things up
40RUN rm -f "$HOME/rpmbuild/rpm/$(uname -m)/"*.rpm
41RUN rm -f "$spdk_tar"
42RUN rm -rf "$spdk_repo"
43RUN dnf clean all
44
45# We are doing a multi-stage build here. This means that previous image,
46# base, is going to end up as an intermediate one, untagged, <none> - this
47# image can be then manually removed (--force-rm doesn't work here. Go
48# figure).
49FROM fedora:35 AS spdk
50
51LABEL maintainer=spdk.io
52
53# Proxy configuration must be set for each build separately...
54ARG PROXY
55ARG NO_PROXY
56
57ENV http_proxy=$PROXY
58ENV https_proxy=$PROXY
59ENV no_proxy=$NO_PROXY
60
61# Copy SPDK's RPMs built during pre-install step.
62COPY --from=base /tmp/*.rpm /tmp/
63COPY --from=base /tmp/fio /tmp/
64# Wrap up the image
65COPY post-install /install
66RUN /install
67