-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
114 lines (87 loc) · 3.77 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
# MARK: builder
FROM ubuntu:22.04 as builder
RUN apt-get update && apt-get install -y wget build-essential fakeroot devscripts equivs git
# Download code and install build dependencies
RUN mkdir -p /tmp/builder/slurm \
&& cd /tmp/builder/slurm \
&& git init \
&& git remote add origin https://github.com/WATonomous/slurm.git \
&& git fetch origin 417362ec31eb302830b7a63049c6c92da625fa29 --depth=1 \
&& git reset --hard FETCH_HEAD \
&& mk-build-deps --install --tool "apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" debian/control
# Install packages to enable building of plugins
# https://slurm.schedmd.com/quickstart_admin.html#prereqs
RUN apt-get update && apt-get install -y \
# for the auth/munge plugin
libmunge-dev \
# for the mysql plugin
libmysqlclient-dev \
# for the cgroup/v2 plugin
libhwloc-dev \
libdbus-1-dev \
# for HDF5 job accounting
libhdf5-dev \
# for Lua API
liblua5.3-dev \
# for NVIDIA GPU support
libnvidia-ml-dev \
# for readline support
libreadline-dev \
# for rest API
libhttp-parser-dev \
libjson-c-dev \
libyaml-dev \
libjwt-dev
RUN cd /tmp/builder/slurm* \
&& ./configure --prefix /opt/slurm --sysconfdir /etc/slurm \
&& make -j$(nproc) install \
&& cd / \
&& rm -rf /tmp/builder
# MARK: packager
# Package the built slurm package
FROM ubuntu:22.04 as packager
COPY --from=builder /opt/slurm /opt/slurm
RUN tar -C /opt -czf /opt/slurm.tar.gz slurm
# MARK: daemon-base
# Base image for any daemon. Contains munge, slurm binaries, convenience scripts, and supervisord
FROM ubuntu:22.04 as daemon-base
# Create the users. 60430 is the default slurm uid. 60429 for munge is arbitrary.
RUN groupadd --gid 64029 munge && useradd --uid 64029 --gid 64029 --home-dir /var/spool/munge --no-create-home --shell /bin/false munge
RUN groupadd --gid 64030 slurm && useradd --uid 64030 --gid 64030 --home-dir /var/spool/slurm --no-create-home --shell /bin/false slurm
# Install runtime dependencies
RUN apt-get update && apt-get install libmunge2 munge supervisor inotify-tools liblua5.3-0 -y
RUN mkdir /run/munge && chown munge:munge /run/munge
# Copy the built slurm binaries from the builder stage
COPY --from=builder /opt/slurm /opt/slurm
# Default configuration options in supervisord.conf that can be overridden at runtime
ENV MUNGED_ARGS=
ENV SLURMCTLD_ARGS=
# This allows the user to use a pre-existing munge key
ENV MUNGE_KEY_IMPORT_PATH=/etc/munge/munge.imported.key
COPY daemon-base/supervisord.conf /etc/supervisord.conf
# Convenience scripts
COPY daemon-base/prefix-output.sh /opt/prefix-output.sh
RUN chmod +x /opt/prefix-output.sh
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
# MARK: slurmctld
FROM daemon-base as slurmctld
# Set up for the runtime agent
RUN mkdir /etc/slurm /etc/runtime_config && touch /etc/runtime_config/passwd /etc/runtime_config/group
RUN cp /etc/passwd /etc/passwd.system && cp /etc/group /etc/group.system
# Copy configuration files and scripts
COPY slurmctld/runtime-agent.sh /opt/runtime-agent.sh
RUN chmod +x /opt/runtime-agent.sh
COPY slurmctld/entrypoint.sh /opt/entrypoint.sh
RUN chmod +x /opt/entrypoint.sh
COPY slurmctld/supervisor-conf/ /etc/supervisor/conf.d/
ENTRYPOINT ["/opt/entrypoint.sh"]
# MARK: slurmdbd
FROM daemon-base as slurmdbd
RUN apt update && apt install -y libmysqlclient21
# Set up for the runtime agent
RUN mkdir /etc/slurm /etc/runtime_config /etc/slurmdbd_config && touch /etc/runtime_config/passwd /etc/runtime_config/group
RUN cp /etc/passwd /etc/passwd.system && cp /etc/group /etc/group.system
# Copy configuration files and scripts
COPY slurmdbd/runtime-agent.sh /opt/runtime-agent.sh
RUN chmod +x /opt/runtime-agent.sh
COPY slurmdbd/supervisor-conf/ /etc/supervisor/conf.d/