@@ -34,10 +34,6 @@ RUN set -euo pipefail; \
3434 # External dependencies.
3535 libcurl4-openssl-dev \
3636 libmysqlclient-dev \
37- libqt5svg5-dev \
38- qt5-qmake \
39- qt5dxcb-plugin \
40- qtbase5-dev \
4137 zstd \
4238 # Shell tools, source retrieval and networking.
4339 sed \
@@ -91,7 +87,13 @@ ENV SPACK_STACK_DIR=/opt/spack-stack \
9187
9288# Copy spack-stack from build context. Note the build context must be the
9389# root of the spack-stack repository (see the README.md for details).
94- COPY . ${SPACK_STACK_DIR}
90+ # Do not copy the dockerfiles into the container.
91+ COPY --exclude=configs/sites/tier1/container/Dockerfile.oneapi \
92+ --exclude=configs/sites/tier1/container/Dockerfile.gcc \
93+ --exclude=configs/sites/tier1/container/packages_gcc.yaml \
94+ --exclude=envs/** \
95+ --exclude=cache/** \
96+ . ${SPACK_STACK_DIR}
9597
9698# Create spack-stack environment
9799WORKDIR /opt/spack-stack
@@ -105,12 +107,19 @@ RUN mkdir -p /tmp/spack-stack && \
105107 --compiler oneapi && \
106108 cd ${SPACK_STACK_DIR}/envs/container && \
107109 spack env activate . && \
108- spack concretize 2>&1 | tee log.concretize && \
109- spack install --fail-fast -j ${BUILD_JOBS} 2>&1 | tee log.install && \
110+ spack concretize 2>&1 | tee log.concretize
111+
112+ # Build the spack environment.
113+ RUN source setup.sh && cd ${SPACK_STACK_DIR}/envs/container && spack env activate . && \
114+ spack install --fail-fast -j ${BUILD_JOBS} 2>&1 | tee log.install
115+
116+ # Setup modules and meta-modules.
117+ RUN source setup.sh && cd ${SPACK_STACK_DIR}/envs/container && spack env activate . && \
110118 spack module tcl refresh -y && \
111119 spack stack setup-meta-modules && \
112120 # Save output of spack find.
113121 spack find 2>&1 | tee /opt/spack-software/spack_find.out && \
122+ cp ./log.concretize /opt/spack-software/log.concretize && \
114123 spack clean --all
115124
116125## ---------- Create runtime container ----------
@@ -129,10 +138,22 @@ RUN echo "ulimit -s unlimited" > /etc/spack_container_rc.sh \
129138 && echo "export CXX=icpx" >> /etc/spack_container_rc.sh \
130139 && echo "export FC=ifx" >> /etc/spack_container_rc.sh \
131140 && echo "# TCL module path for the spack-stack environment." >> /etc/spack_container_rc.sh \
132- && echo "export MODULEPATH=/opt/spack-software/modules/Core" >> /etc/spack_container_rc.sh \
133141 && echo "source /etc/profile.d/modules.sh" >> /etc/spack_container_rc.sh \
134142 && echo "module use /opt/intel/oneapi/modulefiles" >> /etc/spack_container_rc.sh \
135- && echo "module use /opt/spack-software/modules/Core" >> /etc/spack_container_rc.sh \
143+ && echo "module use /opt/spack-software/modulefiles" >> /etc/spack_container_rc.sh \
144+ && echo "module use /opt/spack-software/modulefiles/Core" >> /etc/spack_container_rc.sh \
145+ && echo "# Bash function to load modules necessary to build the JEDI bundle." >> /etc/spack_container_rc.sh \
146+ && echo "load_jedi_bundle_env() {" >> /etc/spack_container_rc.sh \
147+ && echo " module purge" >> /etc/spack_container_rc.sh \
148+ && echo " module load stack-intel-oneapi-compilers" >> /etc/spack_container_rc.sh \
149+ && echo " module load stack-intel-oneapi-mpi" >> /etc/spack_container_rc.sh \
150+ && echo " module load base-env" >> /etc/spack_container_rc.sh \
151+ && echo " module load jedi-mpas-env" >> /etc/spack_container_rc.sh \
152+ && echo " module load py-fortranformat" >> /etc/spack_container_rc.sh \
153+ && echo " module load jedi-fv3-env" >> /etc/spack_container_rc.sh \
154+ && echo " module load ewok-env" >> /etc/spack_container_rc.sh \
155+ && echo " module load ip" >> /etc/spack_container_rc.sh \
156+ && echo "}" >> /etc/spack_container_rc.sh \ \
136157 && echo "source /etc/spack_container_rc.sh" >> /etc/bash.bashrc \
137158 && printf "[credential]\n helper = cache --timeout=7200\n" >> /root/.gitconfig \
138159 && mkdir /root/.pmix
0 commit comments