# Start with docker base
FROM centos:7

LABEL maintainer="Marcel Nijenhof <marceln@pion.xs4all.nl>"

#
# Install and update
#
ADD files/slurm.repo /etc/yum.repos.d/slurm.repo

RUN "/usr/bin/yum" "-y" "update"

RUN "/usr/bin/yum" "-y" "install" \
	https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

RUN "/usr/bin/yum" "-y" "install" \
	slurm \
	mpich-3.0 \
	mpitests-mpich

RUN "/usr/sbin/groupadd" "-g" "1000" "marceln"
RUN "/usr/sbin/useradd" \
	"-c" "Marcel Nijenhof" \
	"-u" "1000" \
	"-g" "marceln" \
	"-G" "wheel" \
	"-p" '$6$noVPG3snbYoJqcpO$7ii6A0GJPLzKS1cwjypUkSSID8uHG2rA3plQQifLONh9gtHpq1QY08Wako7wzFE7jMbkbFSgB3a3xlhQkvTQ00' \
	"marceln"

#
# Munge config
#
ADD files/munge.key /etc/munge/munge.key
RUN chown munge:munge /etc/munge/munge.key
RUN chmod 600 /etc/munge/munge.key

#
# Slurm config
#
RUN mkdir /opt/slurm/etc /var/log/slurm/
ADD files/slurm.conf /opt/slurm/etc/slurm.conf
ADD files/slurm.sh /etc/profile.d/slurm.sh

#
# Add wait
#
ADD files/wait /sbin/wait
