Skip to content

Commit

Permalink
[docker] Update xrd-docker and Dockerfiles for new packaging
Browse files Browse the repository at this point in the history
The tests now run as part of the RPM builds, so no need to setup
and start containers. Just running the builds will already run the
tests.
  • Loading branch information
amadio committed Dec 10, 2023
1 parent c968ddd commit f6ac31a
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 334 deletions.
40 changes: 13 additions & 27 deletions docker/build/Dockerfile.alma8
Original file line number Diff line number Diff line change
@@ -1,46 +1,32 @@
FROM almalinux:8

# Install tools necessary for RPM development
RUN dnf install -y rpm-build rpmdevtools dnf-plugins-core epel-release \
RUN dnf install -y dnf-plugins-core epel-release rpmdevtools sudo \
&& dnf config-manager --set-enabled powertools

# Create xrootd user to avoid running tests as root
RUN groupadd xrootd && useradd -g xrootd -m xrootd

USER xrootd
WORKDIR /home/xrootd

# Create directory tree for building RPMs
RUN rpmdev-setuptree

WORKDIR /root

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz rpmbuild/SOURCES

# Extract spec file to build RPMs
RUN tar xzf rpmbuild/SOURCES/xrootd.tar.gz --strip-components=1 xrootd/xrootd.spec

USER root

# Install build dependencies with dnf
RUN dnf builddep -y -D 'dist .el8' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec
RUN dnf builddep -y xrootd.spec

# Build RPMS for XRootD
RUN rpmbuild -bb -D 'dist .el8' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Second stage, build test image
FROM almalinux:8

COPY --from=0 /root/rpmbuild/RPMS/* /tmp/

# Install RPMS for XRootD and cleanup unneeded files
RUN rm /tmp/*-{devel,doc}* \
&& dnf install -y dnf-plugins-core epel-release \
&& dnf config-manager --set-enabled powertools \
&& dnf install -y /tmp/*.rpm \
&& dnf autoremove -y \
&& rm -rf /tmp/*

# Copy configuration files
COPY config/*.cfg /etc/xrootd/
COPY scripts/setup.sh /bin/setup.sh
RUN sudo -u xrootd rpmbuild -bb --with git xrootd.spec

CMD [ "/sbin/init" ]
# Install RPMS
RUN yum install -y rpmbuild/RPMS/*/*.rpm
40 changes: 13 additions & 27 deletions docker/build/Dockerfile.alma9
Original file line number Diff line number Diff line change
@@ -1,46 +1,32 @@
FROM almalinux:9

# Install tools necessary for RPM development
RUN dnf install -y rpm-build rpmdevtools dnf-plugins-core epel-release \
RUN dnf install -y dnf-plugins-core epel-release rpmdevtools sudo \
&& dnf config-manager --set-enabled crb

# Create xrootd user to avoid running tests as root
RUN groupadd xrootd && useradd -g xrootd -m xrootd

USER xrootd
WORKDIR /home/xrootd

# Create directory tree for building RPMs
RUN rpmdev-setuptree

WORKDIR /root

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz rpmbuild/SOURCES

# Extract spec file to build RPMs
RUN tar xzf rpmbuild/SOURCES/xrootd.tar.gz --strip-components=1 xrootd/xrootd.spec

USER root

# Install build dependencies with dnf
RUN dnf builddep -y -D 'dist .el9' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec
RUN dnf builddep -y xrootd.spec

# Build RPMS for XRootD
RUN rpmbuild -bb -D 'dist .el9' --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Second stage, build test image
FROM almalinux:9

COPY --from=0 /root/rpmbuild/RPMS/* /tmp/

# Install RPMS for XRootD and cleanup unneeded files
RUN rm /tmp/*-{devel,doc}* \
&& dnf install -y dnf-plugins-core epel-release \
&& dnf config-manager --set-enabled crb \
&& dnf install -y /tmp/*.rpm \
&& dnf autoremove -y \
&& rm -rf /tmp/*

# Copy configuration files
COPY config/*.cfg /etc/xrootd/
COPY scripts/setup.sh /bin/setup.sh
RUN sudo -u xrootd rpmbuild -bb --with git xrootd.spec

CMD [ "/sbin/init" ]
# Install RPMS
RUN yum install -y rpmbuild/RPMS/*/*.rpm
38 changes: 13 additions & 25 deletions docker/build/Dockerfile.centos7
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
FROM centos:7

# Install tools necessary for RPM development
RUN yum install -y centos-release-scl epel-release rpm-build rpmdevtools yum-utils
RUN yum install -y centos-release-scl epel-release git \
&& yum install -y epel-rpm-macros rpmdevtools sudo yum-utils

WORKDIR /root
# Create xrootd user to avoid running tests as root
RUN groupadd xrootd && useradd -g xrootd -m xrootd

USER xrootd
WORKDIR /home/xrootd

# Create directory tree for building RPMs
RUN rpmdev-setuptree
Expand All @@ -15,30 +20,13 @@ COPY xrootd.tar.gz rpmbuild/SOURCES
# Extract spec file to build RPMs
RUN tar xzf rpmbuild/SOURCES/xrootd.tar.gz --strip-components=1 xrootd/xrootd.spec

USER root

# Install build dependencies with yum
RUN yum-builddep -y --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec
RUN yum-builddep -y xrootd.spec

# Build RPMS for XRootD
RUN rpmbuild -bb --define '_with_isal 1' --define '_with_python3 1' \
--define '_with_scitokens 1' --define '_with_tests 1' --define '_with_xrdclhttp 1' \
--define '_build_name_fmt %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' xrootd.spec

# Second stage, build test image
FROM centos:7

COPY --from=0 /root/rpmbuild/RPMS/* /tmp/

# Install RPMS for XRootD and cleanup unneeded files
RUN rm /tmp/*-{devel,doc}* \
&& yum install -y epel-release \
&& yum install -y wget /tmp/*.rpm \
&& yum autoremove -y \
&& rm -rf /tmp/*

# Copy configuration files
COPY config/*.cfg /etc/xrootd/
COPY scripts/setup.sh /bin/setup.sh
RUN sudo -u xrootd rpmbuild -bb --with git xrootd.spec

CMD [ "/sbin/init" ]
# Install RPMS
RUN yum install -y rpmbuild/RPMS/*/*.rpm
31 changes: 31 additions & 0 deletions docker/build/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
ARG version=12
FROM debian:$version

RUN apt update
RUN apt install -y build-essential devscripts equivs sudo

# Create xrootd user to avoid running tests as root
RUN groupadd xrootd && useradd -g xrootd -m xrootd

USER xrootd
WORKDIR /home/xrootd

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz .

# Extract tarball
RUN tar xzf xrootd.tar.gz

USER root
WORKDIR /home/xrootd/xrootd

# Install build dependencies with dnf
RUN echo yes | mk-build-deps --install --remove debian/control

# Build DEB packages for XRootD
RUN export VERSION=$(sed -e 's/v//; s/-rc/~rc/; s/-g/+git/; s/-/.post/; s/-/./' < VERSION) \
&& sudo -u xrootd dch --create --package xrootd -v ${VERSION} -M 'XRootD automated build.' \
&& sudo -u xrootd debuild --no-tgz-check --no-sign -b

RUN apt install -y ../*.d*eb
32 changes: 32 additions & 0 deletions docker/build/Dockerfile.fedora
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
ARG version=rawhide
FROM fedora:$version

# Install tools necessary for RPM development
RUN dnf install -y dnf-plugins-core rpmdevtools sudo

# Create xrootd user to avoid running tests as root
RUN groupadd xrootd && useradd -g xrootd -m xrootd

USER xrootd
WORKDIR /home/xrootd

# Create directory tree for building RPMs
RUN rpmdev-setuptree

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz rpmbuild/SOURCES

# Extract spec file to build RPMs
RUN tar xzf rpmbuild/SOURCES/xrootd.tar.gz --strip-components=1 xrootd/xrootd.spec

USER root

# Install build dependencies with dnf
RUN dnf builddep -y xrootd.spec

# Build RPMS for XRootD
RUN sudo -u xrootd rpmbuild -bb --with git xrootd.spec

# Install RPMS
RUN yum install -y rpmbuild/RPMS/*/*.rpm
33 changes: 33 additions & 0 deletions docker/build/Dockerfile.ubuntu
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
ARG version=22.04
FROM ubuntu:$version

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update
RUN apt install -y build-essential devscripts equivs sudo

# Create xrootd user to avoid running tests as root
RUN groupadd xrootd && useradd -g xrootd -m xrootd

USER xrootd
WORKDIR /home/xrootd

# XRootD source tarball must be created in the
# current directory in order to build this image
COPY xrootd.tar.gz .

# Extract tarball
RUN tar xzf xrootd.tar.gz

USER root
WORKDIR /home/xrootd/xrootd

# Install build dependencies with dnf
RUN echo yes | mk-build-deps --install --remove debian/control

# Build DEB packages for XRootD
RUN export VERSION=$(sed -e 's/v//; s/-rc/~rc/; s/-g/+git/; s/-/.post/; s/-/./' < VERSION) \
&& sudo -u xrootd dch --create --package xrootd -v ${VERSION} -M 'XRootD automated build.' \
&& sudo -u xrootd debuild --no-tgz-check --no-sign -b

RUN apt install -y ../*.d*eb
59 changes: 0 additions & 59 deletions docker/config/xrootd-clustered.cfg

This file was deleted.

4 changes: 0 additions & 4 deletions docker/config/xrootd-srv2.cfg

This file was deleted.

Loading

0 comments on commit f6ac31a

Please sign in to comment.