Skip to content

Commit

Permalink
add slurm to dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
alexboden committed Oct 28, 2024
1 parent 2f3eb0f commit 874a8f9
Showing 1 changed file with 43 additions and 7 deletions.
50 changes: 43 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
# Use the Slurm base image
# Use the specified Slurm base image with slurmdbd
FROM ghcr.io/watonomous/slurm-dist:sha-d71cada1ede70e133c6765e0239840ec97aadd40-slurmdbd

# Install Python and any dependencies
RUN apt-get update && apt-get install -y python3 python3-pip && rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y python3 python3-pip supervisor inotify-tools liblua5.3-0 libmysqlclient21 \
&& rm -rf /var/lib/apt/lists/*

# Create users
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

# Set up munge directory
RUN mkdir /run/munge && chown munge:munge /run/munge

# Set the working directory in the container
WORKDIR /app
Expand All @@ -14,9 +22,37 @@ COPY main.py config.py runner_size_config.py RunningJob.py allocate-ephemeral-ru
COPY requirements.txt /app/
RUN pip3 install -r requirements.txt

# Run the Python script
# Note the env variable GITHUB_ACCESS_TOKEN will need to be set in order to authenticate with the GitHub API
# CMD ["python3", "main.py"]
ENTRYPOINT ["python3", "/app/main.py"]
# Set up runtime configurations for slurmctld
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 and prepare daemon-specific configurations
COPY daemon-base/supervisord.conf /etc/supervisord.conf
COPY daemon-base/prefix-output.sh /opt/prefix-output.sh
RUN chmod +x /opt/prefix-output.sh

# Copy and set permissions for slurmctld and slurmdbd runtime agents
COPY slurmctld/runtime-agent.sh /opt/runtime-agent.sh
RUN chmod +x /opt/runtime-agent.sh
COPY slurmdbd/runtime-agent.sh /opt/runtime-agent.sh
RUN chmod +x /opt/runtime-agent.sh

# USER alexboden
# Copy entrypoint and supervisor configurations for slurmctld and slurmdbd
COPY slurmctld/entrypoint.sh /opt/entrypoint.sh
RUN chmod +x /opt/entrypoint.sh
COPY slurmctld/supervisor-conf/ /etc/supervisor/conf.d/
COPY slurmdbd/supervisor-conf/ /etc/supervisor/conf.d/

# Expose ports if needed by Slurm
EXPOSE 6817 6818 6819

# Environment variables for custom configuration paths
ENV MUNGED_ARGS= \
SLURMCTLD_ARGS= \
MUNGE_KEY_IMPORT_PATH=/etc/munge/munge.imported.key

# Start supervisord for process management and the Python script
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

# Run the Python script as the main application entry point
ENTRYPOINT ["python3", "/app/main.py"]

0 comments on commit 874a8f9

Please sign in to comment.