Skip to content

Commit

Permalink
Granular file copy from build layers to finished image
Browse files Browse the repository at this point in the history
  • Loading branch information
kincl committed Sep 6, 2023
1 parent d313e5e commit 7d0fb5f
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 20 deletions.
22 changes: 18 additions & 4 deletions slurm/images/munge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,29 @@ RUN curl -LO https://github.com/dun/munge/releases/download/munge-${MUNGE_VERSIO
make && \
make install

FROM scratch as tmp

COPY --from=build /etc/munge /etc/munge
COPY --from=build /var/lib/munge /var/lib/munge
COPY --from=build /var/log/munge /var/log/munge
COPY --from=build /run/munge /run/munge
COPY --from=build /usr/lib/*munge* /usr/lib/
COPY --from=build /usr/lib/pkgconfig/munge.pc /usr/lib/pkgconfig
COPY --from=build /usr/include/*munge* /usr/include/
COPY --from=build /usr/share/man/man1/*munge* /usr/share/man/man1/
COPY --from=build /usr/share/man/man3/*munge* /usr/share/man/man3/
COPY --from=build /usr/share/man/man7/*munge* /usr/share/man/man7/
COPY --from=build /usr/share/man/man8/*munge* /usr/share/man/man8/
COPY --from=build /usr/bin/*munge* /usr/bin/
COPY --from=build /usr/sbin/*munge* /usr/sbin/

FROM quay.io/centos/centos:stream9

COPY --from=build /usr /usr
COPY --from=build /etc /etc
COPY --from=build /var /var
# single layer for copy
COPY --from=tmp / /

RUN ldconfig && \
useradd -r -u 500 munge && \
mkdir -v /run/munge && \
chown -v munge:munge /run/munge && \
chown -v munge:munge /etc/munge

Expand Down
36 changes: 20 additions & 16 deletions slurm/images/slurm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
FROM ghcr.io/naps-product-sa/openshift-batch:munge-latest as build
ARG SLURM_VERSION=23.02.4

# RUN echo "[9-stream-crb]" > /etc/yum.repos.d/9-stream-crp.repo && \
# echo "name=9-stream-crb" >> /etc/yum.repos.d/9-stream-crp.repo && \
# echo "baseurl = https://mirror.stream.centos.org/9-stream/CRB/\$basearch/os/" >> /etc/yum.repos.d/9-stream-crp.repo && \
# echo "enabled = 1" >> /etc/yum.repos.d/9-stream-crp.repo && \
# echo "gpgcheck = 0" >> /etc/yum.repos.d/9-stream-crp.repo

# RUN dnf install -y yum-utils

# RUN yum-config-manager --add-repo https://mirror.stream.centos.org/9-stream/BaseOS/\$basearch/os/ && yum-config-manager --add-repo https://mirror.stream.centos.org/9-stream/AppStream/\$basearch/os/

RUN dnf install --enablerepo=crb -y xz gcc openssl-devel bzip2-devel zlib-devel procps-ng bzip2 perl perl-devel git autoconf automake libtool diffutils jansson jansson-devel http-parser-devel
RUN dnf install --enablerepo=crb -y xz gcc procps-ng bzip2 perl git autoconf automake libtool diffutils jansson \
openssl-devel bzip2-devel zlib-devel jansson-devel http-parser-devel perl-devel

RUN mkdir /tmp/src
WORKDIR /tmp/src
Expand All @@ -33,15 +24,28 @@ RUN curl -LO https://download.schedmd.com/slurm/slurm-${SLURM_VERSION}.tar.bz2 &
make && \
make install

FROM scratch as tmp

# libjwt
COPY --from=build /usr/include/jwt* /usr/include/
COPY --from=build /usr/lib64/libjwt* /usr/lib/
COPY --from=build /usr/lib64/pkgconfig/libjwt* /usr/lib/pkgconfig/
COPY --from=build /usr/bin/jwt* /usr/bin/

#slurm
COPY --from=build /usr/lib64/*slurm* /usr/lib64/
COPY --from=build /usr/lib64/slurm/ /usr/lib64/slurm/
COPY --from=build /usr/bin/s* /usr/bin/
COPY --from=build /usr/sbin/slurm* /usr/sbin/
COPY --from=build /usr/share/man/ /usr/share/man/

FROM ghcr.io/naps-product-sa/openshift-batch:munge-latest

RUN dnf install -y bind-utils hostname iproute
COPY --from=tmp / /

COPY --from=build /usr /usr
COPY --from=build /etc /etc
COPY --from=build /var /var
RUN dnf install -y bind-utils hostname iproute

RUN ldconfig && \
RUN ldconfig && ldconfig -n /usr/lib64/slurm && \
useradd -r -u 501 slurm && \
mkdir /var/spool/slurmctld && \
chown slurm:slurm /var/spool/slurmctld
Expand Down

0 comments on commit 7d0fb5f

Please sign in to comment.