numam-spdk/docker/build_base/Dockerfile
Michal Berger e8ea27f859 docker: Add docker-compose for building basic SPDK containers
This suite can be used to deploy containers with the following
functionality (more details in README.md):

- storage-target
- proxy-container
- traffic-generator

This will run simple fio test as per fio.conf against nvmf controller
provided by initiator-container. Similar task can be performed directly
from initiator-container as well.

Each container includes SPDK installation with most common tools, e.g.
rpc.py, available under $PATH. This allows for something like:

docker-compose exec storage-target rpc.py nvmf_get_subsystems

Note that SPDK environment heavily depends on a running kernel hence all
the containers need to be privileged. That said, to make sure containers
are not affecting the host too much, some tasks must be done prior running
them. This includes:

- loading proper kernel modules (like nvme-fabrics, etc.)
- allocating hugepages and having at least one hugetlbfs mount
available under /dev/hugepages

base_build is created as docker multi-stage build.

This is done in order to decrease the size of the final image. The
SPDK RPMs are built inside a base image and then copied over to the
main image (+ fio binary) - this leaves all the dependencies inside
the intermediate image instead of the final one.

The resulted difference in size may look similar to the following
(it may differ depending on the docker version etc.):

no multi-stage build: spdk_base == 1.04GB
multi-stage build: spdk_base == 261MB

Signed-off-by: Michal Berger <michalx.berger@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I825bd0d0bb4071bd9d44b6a0749c033894899ae0
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9055
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Monica Kenguva <monica.kenguva@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
2021-10-22 07:02:52 +00:00

41 lines
888 B
Docker

# SPDX-License-Identifier: Apache-2.0
# Copyright (c) Intel Corporation
FROM fedora:33 AS base
# Generic args
ARG PROXY
ARG NO_PROXY
ENV http_proxy=$PROXY
ENV https_proxy=$PROXY
ENV no_proxy=$NO_PROXY
COPY spdk.tar.gz /spdk.tar.gz
COPY pre-install /install
RUN /install
# 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
# image can be then manually removed (--force-rm doesn't work here. Go
# figure).
FROM fedora:33 AS spdk
LABEL maintainer=spdk.io
# Proxy configuration must be set for each build separately...
ARG PROXY
ARG NO_PROXY
ENV http_proxy=$PROXY
ENV https_proxy=$PROXY
ENV no_proxy=$NO_PROXY
# Copy SPDK's RPMs built during pre-install step.
COPY --from=base /tmp/*.rpm /tmp/
COPY --from=base /tmp/fio /tmp/
# Wrap up the image
COPY post-install /install
RUN /install