forked from ceph/ceph-nvmeof
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.spdk
190 lines (159 loc) · 5.94 KB
/
Dockerfile.spdk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# syntax = docker/dockerfile:1.4
# vim: syntax=dockerfile
ARG DNF_OPTS="\
--enablerepo crb \
--nobest \
--nodocs \
--setopt=install_weak_deps=0 \
--setopt=keepcache=1 \
--setopt=cachedir=/var/cache/dnf \
"
FROM quay.io/centos/centos:stream9 AS build
ARG SPDK_CEPH_VERSION \
CEPH_CLUSTER_CEPH_REPO_BASEURL \
SPDK_VERSION \
DNF_OPTS \
SPDK_PKGDEP_ARGS \
SPDK_CONFIGURE_ARGS \
SPDK_TARGET_ARCH \
SPDK_MAKEFLAGS
RUN <<EOF
echo Log variables
echo ======================================================================
echo SPDK_PKGDEP_ARGS=$SPDK_PKGDEP_ARGS
echo SPDK_CONFIGURE_ARGS=$SPDK_CONFIGURE_ARGS
echo SPDK_TARGET_ARCH=$SPDK_TARGET_ARCH
echo SPDK_MAKEFLAGS=$SPDK_MAKEFLAGS
echo CEPH_CLUSTER_CEPH_REPO_BASEURL=$CEPH_CLUSTER_CEPH_REPO_BASEURL
echo ======================================================================
EOF
WORKDIR /src
COPY . .
COPY <<EOF /etc/yum.conf
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=False
skip_if_unavailable=False
cachedir=/var/cache/dnf
install_weak_deps=0
keepcache=True
tsflags=nodocs
EOF
COPY <<EOF /etc/yum.repos.d/ceph.repo
[Ceph]
name=Ceph packages for \$basearch
baseurl=${CEPH_CLUSTER_CEPH_REPO_BASEURL:-https://download.ceph.com/rpm-${SPDK_CEPH_VERSION}/el\$releasever}/\$basearch
enabled=1
priority=2
gpgcheck=0
[Ceph-noarch]
name=Ceph noarch packages
baseurl=${CEPH_CLUSTER_CEPH_REPO_BASEURL:-https://download.ceph.com/rpm-${SPDK_CEPH_VERSION}/el\$releasever}/noarch
enabled=1
priority=2
gpgcheck=0
EOF
RUN \
--mount=type=cache,target=/var/cache/dnf \
--mount=type=cache,target=/var/lib/dnf \
--mount=type=cache,target=/root/.cache/pip \
dnf install $DNF_OPTS -y 'dnf-command(config-manager)' \
&& dnf config-manager --set-enabled crb \
&& dnf install $DNF_OPTS -y \
rpm-build \
git-core \
&& rpm -vih https://buildlogs.centos.org/centos/9-stream/storage/x86_64/ceph-reef/Packages/t/thrift-0.15.0-3.el9s.x86_64.rpm \
&& scripts/pkgdep.sh $SPDK_PKGDEP_ARGS \
&& dnf $DNF_OPTS update -y
RUN \
--mount=type=cache,target=/var/cache/dnf \
--mount=type=cache,target=/var/lib/dnf \
DEPS="no" \
SPDK_VERSION=${SPDK_VERSION:?} \
RPM_RELEASE=0 \
MAKEFLAGS=$SPDK_MAKEFLAGS \
rpmbuild/rpm.sh $SPDK_CONFIGURE_ARGS --target-arch="${SPDK_TARGET_ARCH:?}"
# build bdevperf example, will not be a part of generated rpm
RUN make -C ./examples/bdev/bdevperf
#------------------------------------------------------------------------------
FROM registry.access.redhat.com/ubi9/ubi@sha256:66233eebd72bb5baa25190d4f55e1dc3fff3a9b77186c1f91a0abdb274452072 AS rpm-export
COPY --from=build /root/rpmbuild/rpm /rpm
#------------------------------------------------------------------------------
FROM registry.access.redhat.com/ubi9/ubi@sha256:66233eebd72bb5baa25190d4f55e1dc3fff3a9b77186c1f91a0abdb274452072 as spdk
ARG SPDK_CEPH_VERSION \
SPDK_VERSION \
DNF_OPTS
ARG SPDK_CENTOS_BASE="https://mirror.stream.centos.org/9-stream/BaseOS/x86_64/os/Packages/"
# This would become obsolete as the release rolls out new packages
ARG SPDK_CENTOS_REPO_VER="9.0-21.el9"
ARG SPDK_PKGDEP_ARGS \
SPDK_CONFIGURE_ARGS \
SPDK_MAKEFLAGS
ARG SPDK_NAME \
SPDK_SUMMARY \
SPDK_DESCRIPTION \
SPDK_URL \
SPDK_MAINTAINER \
BUILD_DATE \
SPDK_GIT_REPO \
SPDK_GIT_BRANCH \
SPDK_GIT_COMMIT
# Generic labels
LABEL name="$SPDK_NAME" \
version="$SPDK_VERSION" \
summary="$SPDK_SUMMARY" \
description="$SPDK_DESCRIPTION" \
maintainer="$SPDK_MAINTAINER" \
release="" \
url="$SPDK_URL" \
build-date="$BUILD_DATE" \
vcs-ref="$SPDK_GIT_COMMIT"
# SPDK-specific labels
LABEL io.spdk.version="$SPDK_VERSION" \
io.spdk.build.pkgdep-args="$SPDK_PKGDEP_ARGS" \
io.spdk.build.configure-args="$SPDK_CONFIGURE_ARGS" \
io.spdk.build.makeflags="$SPDK_MAKEFLAGS" \
io.spdk.build.target-arch="$SPDK_TARGET_ARCH" \
io.spdk.build.ceph-release="$SPDK_CEPH_VERSION" \
io.spdk.git.repo="$SPDK_GIT_REPO" \
io.spdk.git.branch="$SPDK_GIT_BRANCH" \
io.spdk.git.commit="$SPDK_GIT_COMMIT"
# CentOS-specific labels
LABEL org.centos.url="$SPDK_CENTOS_BASE" \
org.centos.version="$SPDK_CENTOS_REPO_VER"
COPY --from=build /etc/yum.conf /etc/yum.conf
COPY --from=build /etc/yum.repos.d/ceph.repo /etc/yum.repos.d/ceph.repo
RUN \
--mount=type=bind,from=build,source=/root/rpmbuild/rpm,target=/rpm \
--mount=type=cache,target=/var/cache/dnf \
--mount=type=cache,target=/var/lib/dnf \
rpm -vih $SPDK_CENTOS_BASE/centos-stream-repos-$SPDK_CENTOS_REPO_VER.noarch.rpm \
$SPDK_CENTOS_BASE/centos-gpg-keys-$SPDK_CENTOS_REPO_VER.noarch.rpm \
&& rpm -vih https://buildlogs.centos.org/centos/9-stream/storage/x86_64/ceph-reef/Packages/t/thrift-0.15.0-3.el9s.x86_64.rpm \
&& dnf $DNF_OPTS install -y /rpm/$(uname -m)/*.rpm \
&& dnf $DNF_OPTS update -y
ENTRYPOINT [ "/usr/local/bin/nvmf_tgt" ]
CMD [ "-u", "-r", "/var/tmp/spdk.sock" ]
#------------------------------------------------------------------------------
FROM spdk AS bdevperf
# Default test run duration in secs
ENV BDEVPERF_TEST_DURATION="90"
# RPC socket path
ENV BDEVPERF_SOCKET="/tmp/bdevperf.sock"
# IO Queue depth
ENV BDEVPERF_IO_QUEUE="128"
# IO Block size
ENV BDEVPERF_IO_BS="4096"
# Type of I/O pattern, see https://spdk.io/doc/bdevperf.html
# for available types
ENV BDEVPERF_IO_TYPE="verify"
COPY --from=build /src/build/examples/bdevperf /usr/local/bin/bdevperf
COPY --from=build /src/examples/bdev/bdevperf/bdevperf.py /usr/libexec/spdk/scripts/bdevperf.py
RUN echo "#!/bin/sh -x" > /entrypoint
RUN echo "bdevperf -z -r \$BDEVPERF_SOCKET \\" >> /entrypoint
RUN echo " -q \$BDEVPERF_IO_QUEUE -o \$BDEVPERF_IO_BS \\" >> /entrypoint
RUN echo " -w \$BDEVPERF_IO_TYPE -t \$BDEVPERF_TEST_DURATION" >> /entrypoint
RUN chmod 755 /entrypoint
ENTRYPOINT [ "/entrypoint" ]