@@ -10,6 +10,7 @@ ARG SLURM_VERSION
1010FROM rockylinux/rockylinux:9 AS builder
1111
1212ARG SLURM_VERSION
13+ ARG TARGETARCH
1314
1415# Enable CRB and EPEL repositories for development packages
1516RUN set -ex \
@@ -66,12 +67,19 @@ RUN rpmdev-setuptree
6667COPY rpmbuild/slurm.rpmmacros /root/.rpmmacros
6768
6869# Download official Slurm release tarball and build RPMs with slurmrestd enabled
70+ # Architecture mapping: Docker TARGETARCH (amd64, arm64) -> RPM arch (x86_64, aarch64)
6971RUN set -ex \
72+ && RPM_ARCH=$(case "${TARGETARCH}" in \
73+ amd64) echo "x86_64" ;; \
74+ arm64) echo "aarch64" ;; \
75+ *) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
76+ esac) \
77+ && echo "Building Slurm RPMs for architecture: ${RPM_ARCH}" \
7078 && wget -O /root/rpmbuild/SOURCES/slurm-${SLURM_VERSION}.tar.bz2 \
7179 https://download.schedmd.com/slurm/slurm-${SLURM_VERSION}.tar.bz2 \
7280 && cd /root/rpmbuild/SOURCES \
7381 && rpmbuild -ta slurm-${SLURM_VERSION}.tar.bz2 \
74- && ls -lh /root/rpmbuild/RPMS/x86_64 /
82+ && ls -lh /root/rpmbuild/RPMS/${RPM_ARCH} /
7583
7684# ============================================================================
7785# Stage 2: Runtime image
@@ -84,6 +92,7 @@ LABEL org.opencontainers.image.source="https://github.com/giovtorres/slurm-docke
8492 maintainer="Giovanni Torres"
8593
8694ARG SLURM_VERSION
95+ ARG TARGETARCH
8796
8897# Enable CRB and EPEL repositories for runtime dependencies
8998RUN set -ex \
@@ -125,17 +134,17 @@ RUN set -ex \
125134ARG GOSU_VERSION=1.19
126135
127136RUN set -ex \
128- && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64" \
129- && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-amd64.asc" \
137+ && echo "Installing gosu for architecture: ${TARGETARCH}" \
138+ && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-${TARGETARCH}" \
139+ && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-${TARGETARCH}.asc" \
130140 && export GNUPGHOME="$(mktemp -d)" \
131141 && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
132142 && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
133143 && rm -rf "${GNUPGHOME}" /usr/local/bin/gosu.asc \
134144 && chmod +x /usr/local/bin/gosu \
135145 && gosu nobody true
136146
137- # Copy Slurm RPMs from builder stage
138- COPY --from=builder /root/rpmbuild/RPMS/x86_64/*.rpm /tmp/rpms/
147+ COPY --from=builder /root/rpmbuild/RPMS/*/*.rpm /tmp/rpms/
139148
140149# Install Slurm RPMs
141150RUN set -ex \
@@ -203,7 +212,6 @@ RUN set -ex \
203212 && rm -rf /tmp/slurm-config
204213COPY --chown=slurm:slurm --chmod=0600 examples /root/examples
205214
206- # Copy entrypoint script
207215COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
208216RUN chmod +x /usr/local/bin/docker-entrypoint.sh
209217
0 commit comments