/
Dockerfile.el.8
166 lines (140 loc) · 6.96 KB
/
Dockerfile.el.8
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
# Copyright 2018-2024 Intel Corporation
# All rights reserved.
#
# 'recipe' for Docker to build an image of EL 8 based
# environment for building the DAOS project.
#
# Pull base image
ARG POINT_RELEASE=
ARG BASE_DISTRO=rockylinux/rockylinux:8$POINT_RELEASE
FROM $BASE_DISTRO as basic
LABEL maintainer="daos@daos.groups.io"
# Needed for later use of BASE_DISTRO
ARG BASE_DISTRO
# Intermittent cache-bust. Used to reduce load on the actual CB1 later.
ARG CB0
ARG REPO_FILE_URL
ARG JENKINS_URL
ARG REPOS
# script to install OS updates basic tools and daos dependencies
COPY ./utils/scripts/install-el8.sh /tmp/install.sh
# script to setup local repo if available
COPY ./utils/scripts/helpers/repo-helper-el8.sh /tmp/repo-helper.sh
RUN chmod +x /tmp/repo-helper.sh /tmp/install.sh && \
/tmp/repo-helper.sh && \
rm -f /tmp/repo-helper.sh
FROM basic
# Install OS updates and package. Include basic tools and daos dependencies
RUN dnf upgrade && \
/tmp/install.sh && \
dnf clean all && \
rm -f /tmp/install.sh
# 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 JENKINS_URL
ARG BULLSEYE
RUN if [ "x$BULLSEYE" != "x" ]; then \
dnf install xz && dnf clean all && \
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.xz && \
mkdir -p bullseye && \
tar -C bullseye --strip-components=1 -xf bullseye.tar.xz && \
pushd bullseye && \
./install --quiet --key "${BULLSEYE}" --prefix /opt/BullseyeCoverage && \
popd && \
rm -rf bullseye.tar.xz 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.
COPY requirements-build.txt requirements-utest.txt ./
RUN python3 -m pip --no-cache-dir install --upgrade pip && \
python3 -m pip --no-cache-dir install -r requirements-build.txt -r requirements-utest.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 requirements-ftest.txt .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
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 && \
export JAVA_HOME=$(daos-java/find_java_home.sh) && \
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; \
}
WORKDIR /home/daos
ARG DAOS_KEEP_SRC=no
# Remove local copy
RUN [ "$DAOS_KEEP_SRC" != "no" ] || rm -rf /home/daos/daos /home/daos/pre