forked from daos-stack/daos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.el.9
215 lines (184 loc) · 9.39 KB
/
Dockerfile.el.9
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# Copyright 2022-2023 Intel Corporation
# All rights reserved.
#
# 'recipe' for Docker to build an image of EL 9 based
# environment for building the DAOS project.
#
# Pull base image
ARG BASE_DISTRO=almalinux:9
FROM $BASE_DISTRO
LABEL maintainer="[email protected]"
# Intermittent cache-bust. Used to reduce load on the actual CB1 later.
ARG CB0
# Use local repo server if present
ARG REPO_FILE_URL
RUN set -e; \
if [ -n "$REPO_FILE_URL" ]; then \
cd /etc/yum.repos.d/ && \
curl -k -f -o daos_ci-el9-artifactory.repo.tmp \
"$REPO_FILE_URL"daos_ci-el9-artifactory.repo && \
for file in *.repo; do \
true > $file; \
done; \
mv daos_ci-el9-artifactory.repo{.tmp,}; \
fi; \
dnf --assumeyes --disablerepo \*epel\* install dnf-plugins-core; \
dnf config-manager --save --setopt=assumeyes=True; \
dnf config-manager --save --setopt=install_weak_deps=False; \
dnf --disablerepo \*epel\* install epel-release; \
dnf install epel-release; \
if [ -n "$REPO_FILE_URL" ]; then \
PT_REPO=daos_ci-rocky8-crb-artifactory; \
else \
PT_REPO=crb; \
fi; \
dnf -y config-manager --enable $PT_REPO; \
dnf -y clean all
ARG JENKINS_URL
ARG REPOS
RUN for repo in $REPOS; do \
branch="master"; \
build_number="lastSuccessfulBuild"; \
if [[ $repo = *@* ]]; then \
branch="${repo#*@}"; \
repo="${repo%@*}"; \
if [[ $branch = *:* ]]; then \
build_number="${branch#*:}"; \
branch="${branch%:*}"; \
fi; \
fi; \
echo -e "[$repo:$branch:$build_number]\n\
name=$repo:$branch:$build_number\n\
baseurl=${JENKINS_URL}job/daos-stack/job/$repo/job/$branch/$build_number/artifact/artifacts/el9/\n\
enabled=1\n\
gpgcheck=False\n" >> /etc/yum.repos.d/$repo:$branch:$build_number.repo; \
cat /etc/yum.repos.d/$repo:$branch:$build_number.repo; \
done
# Install OS updates and package. Include basic tools and daos dependencies
COPY ./utils/scripts/install-el9.sh /tmp/install.sh
RUN chmod +x /tmp/install.sh && dnf upgrade && /tmp/install.sh && dnf clean all && \
rm -f /tmp/install.sh
ENV TZ="Asia/Shanghai"
# RUN ls /usr/share/zoneinfo && \
# cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime && \
# echo "Asia/Shanghai" > /etc/timezone && \
ARG UID=1000
# Add DAOS users
ARG UID=1000
COPY ./utils/scripts/helpers/daos-server-user-setup.sh \
/tmp/daos-server-user-setup.sh
RUN set -e; \
chmod +x /tmp/daos-server-user-setup.sh && \
/tmp/daos-server-user-setup.sh
RUN useradd --no-log-init --user-group --create-home --shell /bin/bash daos_agent
RUN echo "daos_agent:daos_agent" | chpasswd
# Create directory for DAOS backend storage
RUN mkdir -p /opt/daos /mnt/daos /var/run/daos_server /var/run/daos_agent /home/daos/pre /home/daos/daos && \
chown -R daos_server.daos_server /opt/daos /mnt/daos /var/run/daos_server /home/daos && \
chown daos_agent.daos_agent /var/run/daos_agent
ARG QUICKBUILD=false
ARG QUICKBUILD_DEPS
RUN if $QUICKBUILD; then \
echo "Installing: $QUICKBUILD_DEPS"; \
echo "$QUICKBUILD_DEPS" | sed -e '/^$/d' | tr '\n' '\0' | \
xargs -0 dnf install; \
dnf clean all; \
fi
ARG BULLSEYE
RUN if [ "x$BULLSEYE" != "x" ]; then \
curl ${JENKINS_URL}job/daos-stack/job/tools/job/master/lastSuccessfulBuild/artifact/bullseyecoverage-linux.tar \
--retry 10 --retry-max-time 60 --silent --show-error -o bullseye.tar; \
mkdir -p bullseye; \
tar -C bullseye --strip-components=1 -xf bullseye.tar; \
pushd bullseye; \
./install --quiet --key "${BULLSEYE}" --prefix /opt/BullseyeCoverage; \
popd; \
rm -f bullseye.tar; \
rm -rf bullseye; \
fi
USER daos_server:daos_server
# Setup a python venv so that python packages can be installed locally.
RUN python3 -m venv /home/daos/venv
ENV PATH=/home/daos/venv/bin:$PATH
ENV VIRTUAL_ENV=/home/daos/venv/
# Install latest versions of python tools.
# wheel is needed first to avoid a warning when installing pyyaml.
COPY requirements.txt .
RUN python3 -m pip --no-cache-dir install --upgrade pip && \
python3 -m pip --no-cache-dir install wheel && \
python3 -m pip --no-cache-dir install --requirement requirements.txt
WORKDIR /home/daos/pre
RUN mkdir -p /home/daos/pre/site_scons/prereq_tools /home/daos/pre/site_scons/components
COPY --chown=daos_server:daos_server SConstruct .
COPY --chown=daos_server:daos_server site_scons/prereq_tools site_scons/prereq_tools
COPY --chown=daos_server:daos_server site_scons/components site_scons/components
COPY --chown=daos_server:daos_server utils/build.config utils/
# Control what to build. By default Dockerfiles build everything to allow for
# ease-of-use for users, however in CI everything is turned off and then
# selectively enabled. Turning off any step disables all future steps.
ARG DAOS_DEPS_BUILD=yes
ARG DAOS_KEEP_BUILD=no
ARG DAOS_TARGET_TYPE=release
# Now do an update to ensure software is up to date for the deps build. If the
# src hasn't changed then this won't do anything, but if it has then we want to
# ensure that latest dependencies are used.
USER root:root
RUN [ "$DAOS_DEPS_BUILD" != "yes" ] || { \
dnf upgrade --exclude=spdk,spdk-devel,dpdk-devel,dpdk,mercury-devel,mercury && \
dnf clean all; \
}
USER daos_server:daos_server
ARG DEPS_JOBS=1
RUN [ "$DAOS_DEPS_BUILD" != "yes" ] || { \
scons --build-deps=only --jobs $DEPS_JOBS PREFIX=/opt/daos \
TARGET_TYPE=$DAOS_TARGET_TYPE && \
([ "$DAOS_KEEP_BUILD" != "no" ] || /bin/rm -rf build *.gz); \
}
USER root:root
# force an upgrade to get any newly built RPMs, but only if CB1 is set.
ARG CB1
RUN [ -z "$CB1" ] || { \
dnf upgrade --exclude=spdk,spdk-devel,dpdk-devel,dpdk,mercury-devel,mercury && \
dnf clean all; \
}
USER daos_server:daos_server
# Set a label. This is useful for searching for DAOS images, but is also used
# in github-actions to prune elements of the dockerfile below this point.
LABEL DAOS=true
WORKDIR /home/daos/daos/
COPY --chown=daos_server:daos_server VERSION LICENSE ftest.sh SConstruct .clang-format ./
COPY --chown=daos_server:daos_server site_scons site_scons
COPY --chown=daos_server:daos_server utils utils
COPY --chown=daos_server:daos_server src src
# select compiler to use
ARG COMPILER=gcc
ARG JOBS=$DEPS_JOBS
ARG DAOS_BUILD_TYPE=$DAOS_TARGET_TYPE
ARG DAOS_BUILD=$DAOS_DEPS_BUILD
# Build DAOS
RUN [ "$DAOS_BUILD" != "yes" ] || { \
scons --jobs $JOBS install PREFIX=/opt/daos COMPILER=$COMPILER \
BUILD_TYPE=$DAOS_BUILD_TYPE TARGET_TYPE=$DAOS_TARGET_TYPE && \
([ "$DAOS_KEEP_BUILD" != "no" ] || /bin/rm -rf build) && \
go clean -cache && \
cp -r utils/config/examples /opt/daos; \
}
# Set environment variables
ENV PATH=/opt/daos/bin:$PATH
ENV FI_SOCKETS_MAX_CONN_RETRY=1
# Build java and hadoop bindings
WORKDIR /home/daos/daos/src/client/java
ARG DAOS_JAVA_BUILD=$DAOS_BUILD
# Disable Java build for now since it fails
#RUN [ "$DAOS_JAVA_BUILD" != "yes" ] || { \
# mkdir /home/daos/.m2 && \
# cp /home/daos/daos/utils/scripts/helpers/maven-settings.xml.in /home/daos/.m2/settings.xml && \
# mvn clean install -T 1C \
# -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
# -DskipITs -Dgpg.skip -Ddaos.install.path=/opt/daos; \
# }
USER root:root
WORKDIR /home/daos
# ARG DAOS_KEEP_SRC=no
# # Remove local copy
# RUN [ "$DAOS_KEEP_SRC" != "no" ] || rm -rf /home/daos/daos /home/daos/pre