Skip to content
Snippets Groups Projects
Dockerfile 1.7 KiB
Newer Older
Zef Wolffs's avatar
Zef Wolffs committed
# split into two parts:
#   builder: copies the source code and compiles if necessary, then installing
#  <last>: copies the installation so that the source code is dropped, but based on preBuilder to keep cmake etc
FROM gitlab-registry.cern.ch/atlas/statanalysis:base-image-alma AS builder
# Add cmake/cpack to path
ENV PATH $PATH:/opt/cmake/3.27.5/Linux-x86_64/bin
COPY . /home/atlas/source/
# Build StatAnalysis package
RUN rpmFile=(/home/atlas/source/ci_build/*.rpm); \
    if [ ! -e "${rpmFile[0]}" ] 2>&1; then \
    source /opt/lcg/gcc/13.1.0*/x86_64-*/setup.sh && \
    export MAKEFLAGS="-j`nproc` -l`nproc`" && \
    mkdir /home/atlas/source/ci_build && cd /home/atlas/source/ci_build && \
    cmake /home/atlas/source/ && cmake --build . && \
    cpack -G RPM ; fi && \
Zef Wolffs's avatar
Zef Wolffs committed
    sudo rpm -i /home/atlas/source/ci_build/*.rpm && \
    rm -rf /home/atlas/source && \
    sudo yum clean all
# multistage build ... should mean we drop the bit above and just copy the release area...
FROM gitlab-registry.cern.ch/atlas/statanalysis:base-image-alma
# Set up the environment setup script.
COPY docker/release_setup.sh /
Zef Wolffs's avatar
Zef Wolffs committed
# Set up the message of the day, and optionally copy latest versions too if it exists.
COPY docker/motd /etc/
# copy aka install the release into the image ... hopefully each release can use the previous layers as-is
COPY --from=builder /usr/StatAnalysis /usr/StatAnalysis

# Switch back to the ATLAS account.
USER atlas
# change workdir from default / to a writable directory
WORKDIR /workdir

# Start the image with BASH by default, after having printed the message
Zef Wolffs's avatar
Zef Wolffs committed
# of the day and the currently included versions.
ENTRYPOINT ["/release_setup.sh"]
CMD ["/bin/bash"]