-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
129 lines (116 loc) · 3.58 KB
/
Dockerfile
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
FROM rockylinux:8 as slurmbuild
ARG SLURM_VERSION
# Install any required system tools
RUN yum install -y epel-release \
&& yum install -y --enablerepo=powertools \
# Required for slurm
#rocm-device-libs \
hwloc-devel \
hdf5-devel \
man2html \
libibumad \
freeipmi-devel \
lua-devel \
munge-devel \
mariadb-devel \
numactl-devel \
pam-devel \
pmix-devel \
readline-devel \
http-parser-devel \
json-c-devel \
libyaml-devel \
libjwt-devel \
rrdtool-devel \
perl-ExtUtils-MakeMaker \
libbpf-devel \
dbus-devel \
git \
rpm-build \
wget \
python3 \
make \
&& yum clean all \
&& rm -rf /var/cache/yum
# Build Slurm RPMs
RUN wget https://download.schedmd.com/slurm/slurm-$SLURM_VERSION.tar.bz2 \
&& rpmbuild -ta slurm-$SLURM_VERSION.tar.bz2 --with slurmrestd \
&& rm -rf slurm-$SLURM_VERSION.tar.bz2
FROM rockylinux:8
COPY --from=slurmbuild \
/root/rpmbuild/RPMS/x86_64/slurm-$SLURM_VERSION*.rpm \
/root/rpmbuild/RPMS/x86_64/slurm-slurmctld-$SLURM_VERSION*.rpm \
/root/rpmbuild/RPMS/x86_64/slurm-slurmd-$SLURM_VERSION*.rpm \
/root/rpmbuild/RPMS/x86_64/slurm-slurmdbd-$SLURM_VERSION*.rpm \
/root/rpmbuild/RPMS/x86_64/slurm-slurmrestd-$SLURM_VERSION*.rpm \
/root/
ARG SLURM_VERSION
# Install any required system tools
RUN yum install -y epel-release \
&& yum install -y --enablerepo=powertools \
# Support multiple Python versions for downstream testing scenarios
python39 \
python3.11 \
python3.11-pip \
python3.12 \
python3.12-pip \
# Required by Slurm
mariadb-server \
munge \
# Required by the Slurm REST API \
http-parser \
libjwt \
libyaml \
json-c \
# Required for installing python versions not available via yum
bzip2-devel \
libffi-devel \
openssl-devel \
wget \
gcc \
# General tools provided for use by downstream services
bats \
grep \
make \
which \
&& yum clean all \
&& rm -rf /var/cache/yum
# Install Python versions not availible via yum
RUN wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz \
&& tar -xzf Python-3.10.0.tgz \
&& cd Python-3.10.0 \
&& ./configure --enable-optimizations \
&& make altinstall \
&& cd / && rm -rf Python-3.10.0.tgz \
&& rm -rf Python-3.10.0
# Clean up tools required for building Python
RUN yum remove -y \
bzip2-devel \
libffi-devel \
openssl-devel \
wget \
gcc \
&& yum clean all \
&& rm -rf /var/cache/yum
# Install mariadb
RUN /usr/bin/mysql_install_db \
&& chown -R mysql:mysql /var/lib/mysql \
&& chown -R mysql:mysql /var/log/mariadb
# Install Slurm
RUN yum localinstall --enablerepo=powertools -y \
/root/slurm-$SLURM_VERSION*.rpm \
/root/slurm-slurmctld-$SLURM_VERSION*.rpm \
/root/slurm-slurmd-$SLURM_VERSION*.rpm \
/root/slurm-slurmdbd-$SLURM_VERSION*.rpm \
/root/slurm-slurmrestd-$SLURM_VERSION*.rpm \
&& yum clean all \
&& rm -rf /var/cache/yum \
&& rm -rf /root/slurm*.rpm
# Slurm requires a dedicated user/group to run
RUN groupadd -r slurm && useradd -r -g slurm slurm
# Add Slurm config files
COPY --chown=slurm slurm_config/$SLURM_VERSION/slurm.conf /etc/slurm/slurm.conf
COPY --chown=slurm --chmod=600 slurm_config/$SLURM_VERSION/slurmdbd.conf /etc/slurm/slurmdbd.conf
# The entrypoint script starts the DB and defines necessary DB constructs
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]