Skip to content

Commit 316cc0e

Browse files
Aditya AgarwalAditya Agarwal
Aditya Agarwal
authored and
Aditya Agarwal
committed
add slurm dockerfile
1 parent 4f389cd commit 316cc0e

File tree

1 file changed

+158
-0
lines changed

1 file changed

+158
-0
lines changed

.github/Dockerfiles/SLURM/Dockerfile

Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
FROM centos:7.9.2009
2+
3+
LABEL org.opencontainers.image.source="https://github.com/giovtorres/docker-centos7-slurm" \
4+
org.opencontainers.image.title="docker-centos7-slurm" \
5+
org.opencontainers.image.description="Slurm All-in-one Docker container on CentOS 7" \
6+
org.label-schema.docker.cmd="docker run -it -h slurmctl giovtorres/docker-centos7-slurm:latest" \
7+
maintainer="Giovanni Torres"
8+
9+
ENV PATH "/root/.pyenv/shims:/root/.pyenv/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin"
10+
11+
EXPOSE 6817 6818 6819 6820 3306
12+
13+
# Install common YUM dependency packages
14+
# The IUS repo install epel-release as a dependency while also providing a newer version of Git
15+
RUN set -ex \
16+
&& yum makecache fast \
17+
&& yum -y update \
18+
&& yum -y install https://repo.ius.io/ius-release-el7.rpm \
19+
&& yum -y install \
20+
autoconf \
21+
bash-completion \
22+
bzip2 \
23+
bzip2-devel \
24+
file \
25+
iproute \
26+
gcc \
27+
gcc-c++ \
28+
gdbm-devel \
29+
git236 \
30+
glibc-devel \
31+
gmp-devel \
32+
libffi-devel \
33+
libGL-devel \
34+
libX11-devel \
35+
make \
36+
mariadb-server \
37+
mariadb-devel \
38+
munge \
39+
munge-devel \
40+
ncurses-devel \
41+
patch \
42+
perl-core \
43+
pkgconfig \
44+
psmisc \
45+
readline-devel \
46+
sqlite-devel \
47+
tcl-devel \
48+
tix-devel \
49+
tk \
50+
tk-devel \
51+
supervisor \
52+
wget \
53+
which \
54+
vim-enhanced \
55+
xz-devel \
56+
zlib-devel http-parser-devel json-c-devel libjwt-devel libyaml-devel \
57+
&& yum clean all \
58+
&& rm -rf /var/cache/yum
59+
60+
# Set Vim and Git defaults
61+
RUN set -ex \
62+
&& echo "syntax on" >> "$HOME/.vimrc" \
63+
&& echo "set tabstop=4" >> "$HOME/.vimrc" \
64+
&& echo "set softtabstop=4" >> "$HOME/.vimrc" \
65+
&& echo "set shiftwidth=4" >> "$HOME/.vimrc" \
66+
&& echo "set expandtab" >> "$HOME/.vimrc" \
67+
&& echo "set autoindent" >> "$HOME/.vimrc" \
68+
&& echo "set fileformat=unix" >> "$HOME/.vimrc" \
69+
&& echo "set encoding=utf-8" >> "$HOME/.vimrc" \
70+
&& git config --global color.ui auto \
71+
&& git config --global push.default simple
72+
73+
# Add Tini
74+
ENV TINI_VERSION v0.19.0
75+
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
76+
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc /tini.asc
77+
RUN gpg --batch --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \
78+
&& gpg --batch --verify /tini.asc /tini
79+
RUN chmod +x /tini
80+
81+
# Install OpenSSL1.1.1
82+
# See PEP 644: https://www.python.org/dev/peps/pep-0644/
83+
ARG OPENSSL_VERSION="1.1.1s"
84+
RUN set -ex \
85+
&& wget --quiet https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \
86+
&& tar xzf openssl-${OPENSSL_VERSION}.tar.gz \
87+
&& pushd openssl-${OPENSSL_VERSION} \
88+
&& ./config --prefix=/opt/openssl --openssldir=/etc/ssl \
89+
&& make \
90+
&& make test \
91+
&& make install \
92+
&& echo "/opt/openssl/lib" >> /etc/ld.so.conf.d/openssl.conf \
93+
&& ldconfig \
94+
&& popd \
95+
&& rm -f openssl-${OPENSSL_VERSION}.tar.gz
96+
97+
# Install supported Python versions and install dependencies.
98+
# Set the default global to the latest supported version.
99+
# Use pyenv inside the container to switch between Python versions.
100+
ARG PYTHON_VERSIONS="3.8.16 3.9.16 3.10.9 3.11.1"
101+
ARG CONFIGURE_OPTS="--with-openssl=/opt/openssl"
102+
RUN set -ex \
103+
&& curl https://pyenv.run | bash \
104+
&& echo "eval \"\$(pyenv init --path)\"" >> "${HOME}/.bashrc" \
105+
&& echo "eval \"\$(pyenv init -)\"" >> "${HOME}/.bashrc" \
106+
&& source "${HOME}/.bashrc" \
107+
&& pyenv update \
108+
&& for python_version in ${PYTHON_VERSIONS}; \
109+
do \
110+
pyenv install $python_version; \
111+
pyenv global $python_version; \
112+
pip install Cython pytest; \
113+
done
114+
115+
# Compile, build and install Slurm from Git source
116+
ARG SLURM_TAG=slurm-23-02-1-1
117+
ARG JOBS=4
118+
RUN set -ex \
119+
&& git clone -b ${SLURM_TAG} --single-branch --depth=1 https://github.com/SchedMD/slurm.git \
120+
&& pushd slurm \
121+
&& ./configure --prefix=/usr --sysconfdir=/etc/slurm --enable-slurmrestd \
122+
--with-mysql_config=/usr/bin --libdir=/usr/lib64 --enable-multiple-slurmd \
123+
&& sed -e 's|#!/usr/bin/env python3|#!/usr/bin/python|' -i doc/html/shtml2html.py \
124+
&& make -j ${JOBS} install \
125+
&& install -D -m644 etc/cgroup.conf.example /etc/slurm/cgroup.conf.example \
126+
&& install -D -m644 etc/slurm.conf.example /etc/slurm/slurm.conf.example \
127+
&& install -D -m600 etc/slurmdbd.conf.example /etc/slurm/slurmdbd.conf.example \
128+
&& install -D -m644 contribs/slurm_completion_help/slurm_completion.sh /etc/profile.d/slurm_completion.sh \
129+
&& popd \
130+
&& rm -rf slurm \
131+
&& groupadd -r slurm \
132+
&& useradd -r -g slurm slurm \
133+
&& mkdir -p /etc/sysconfig/slurm \
134+
/var/spool/slurmd \
135+
/var/spool/slurmctld \
136+
/var/log/slurm \
137+
/var/run/slurm \
138+
&& chown -R slurm:slurm /var/spool/slurmd \
139+
/var/spool/slurmctld \
140+
/var/log/slurm \
141+
/var/run/slurm \
142+
&& /sbin/create-munge-key
143+
144+
RUN dd if=/dev/random of=/etc/slurm/jwt_hs256.key bs=32 count=1 \
145+
&& chmod 600 /etc/slurm/jwt_hs256.key && chown slurm:slurm /etc/slurm/jwt_hs256.key
146+
147+
COPY --chown=slurm files/slurm/slurm.conf files/slurm/slurmdbd.conf files/slurm/cgroup.conf /etc/slurm/
148+
COPY files/supervisord.conf /etc/
149+
150+
RUN chmod 0600 /etc/slurm/slurmdbd.conf
151+
152+
# Mark externally mounted volumes
153+
VOLUME ["/var/lib/mysql", "/var/lib/slurmd", "/var/spool/slurm", "/var/log/slurm"]
154+
155+
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
156+
157+
ENTRYPOINT ["/tini", "--", "/usr/local/bin/docker-entrypoint.sh"]
158+
CMD ["/bin/bash"]

0 commit comments

Comments
 (0)