Skip to content
Snippets Groups Projects
Commit e32b82bf authored by Wouter Deconinck's avatar Wouter Deconinck
Browse files

feat: move environments into directories

parent 6b538541
No related branches found
No related tags found
1 merge request!529feat: move environments into directories
...@@ -97,10 +97,12 @@ RUN git clone https://github.com/${EICSPACK_ORGREPO}.git ${EICSPACK_ROOT} \ ...@@ -97,10 +97,12 @@ RUN git clone https://github.com/${EICSPACK_ORGREPO}.git ${EICSPACK_ROOT} \
&& spack repo add --scope site "${EICSPACK_ROOT}" && spack repo add --scope site "${EICSPACK_ROOT}"
## Setup our custom environment ## Setup our custom environment
COPY --from=spack spack.yaml /opt/spack-environment/ COPY --from=spack spack-environment/ /opt/spack-environment/
ARG ENV=dev
RUN rm -r /usr/local \ RUN rm -r /usr/local \
&& cd /opt/spack-environment \
&& source $SPACK_ROOT/share/spack/setup-env.sh \ && source $SPACK_ROOT/share/spack/setup-env.sh \
&& spack env activate /opt/spack-environment/ \ && spack env activate --dir /opt/spack-environment/${ENV} \
&& spack concretize --fresh && spack concretize --fresh
...@@ -120,7 +122,7 @@ RUN rm -r /usr/local \ ...@@ -120,7 +122,7 @@ RUN rm -r /usr/local \
RUN --mount=type=cache,target=/var/cache/spack-mirror,sharing=locked \ RUN --mount=type=cache,target=/var/cache/spack-mirror,sharing=locked \
cd /opt/spack-environment \ cd /opt/spack-environment \
&& source $SPACK_ROOT/share/spack/setup-env.sh \ && source $SPACK_ROOT/share/spack/setup-env.sh \
&& spack env activate . \ && spack env activate --dir /opt/spack-environment/${ENV} \
&& status=0 \ && status=0 \
&& spack install -j64 --no-check-signature \ && spack install -j64 --no-check-signature \
|| spack install -j64 --no-check-signature \ || spack install -j64 --no-check-signature \
...@@ -148,7 +150,7 @@ ARG S3RW_ACCESS_KEY="" ...@@ -148,7 +150,7 @@ ARG S3RW_ACCESS_KEY=""
ARG S3RW_SECRET_KEY="" ARG S3RW_SECRET_KEY=""
RUN cd /opt/spack-environment \ RUN cd /opt/spack-environment \
&& source $SPACK_ROOT/share/spack/setup-env.sh \ && source $SPACK_ROOT/share/spack/setup-env.sh \
&& spack env activate . \ && spack env activate --dir /opt/spack-environment/${ENV} \
&& if [ -n "${S3RW_ACCESS_KEY}" ] ; then \ && if [ -n "${S3RW_ACCESS_KEY}" ] ; then \
spack mirror add --scope site \ spack mirror add --scope site \
--s3-endpoint-url https://eics3.sdcc.bnl.gov:9000 \ --s3-endpoint-url https://eics3.sdcc.bnl.gov:9000 \
...@@ -176,7 +178,7 @@ RUN --mount=type=cache,target=/var/cache/pip \ ...@@ -176,7 +178,7 @@ RUN --mount=type=cache,target=/var/cache/pip \
echo "Installing additional python packages" \ echo "Installing additional python packages" \
&& cd /opt/spack-environment \ && cd /opt/spack-environment \
&& source $SPACK_ROOT/share/spack/setup-env.sh \ && source $SPACK_ROOT/share/spack/setup-env.sh \
&& spack env activate . \ && spack env activate --dir /opt/spack-environment/${ENV} \
&& python -m pip install \ && python -m pip install \
--trusted-host pypi.org \ --trusted-host pypi.org \
--trusted-host files.pythonhosted.org \ --trusted-host files.pythonhosted.org \
...@@ -192,11 +194,12 @@ RUN cd /opt/spack-environment \ ...@@ -192,11 +194,12 @@ RUN cd /opt/spack-environment \
&& source $SPACK_ROOT/share/spack/setup-env.sh \ && source $SPACK_ROOT/share/spack/setup-env.sh \
&& echo -n "" \ && echo -n "" \
&& echo "Grabbing environment info" \ && echo "Grabbing environment info" \
&& spack env activate --sh -d . \ && spack env activate --sh --dir /opt/spack-environment/${ENV} \
| sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \ | sed "s?LD_LIBRARY_PATH=?&/lib/x86_64-linux-gnu:?" \
| sed '/MANPATH/ s/;$/:;/' \ | sed '/MANPATH/ s/;$/:;/' \
> /etc/profile.d/z10_spack_environment.sh \ > /etc/profile.d/z10_spack_environment.sh \
&& cd /opt/spack-environment && spack env activate . \ && cd /opt/spack-environment \
&& spack env activate --dir /opt/spack-environment/${ENV} \
&& echo -n "" \ && echo -n "" \
&& echo "Add extra environment variables for Jug, Podio and Gaudi" \ && echo "Add extra environment variables for Jug, Podio and Gaudi" \
&& echo "export PODIO=$(spack location -i podio);" \ && echo "export PODIO=$(spack location -i podio);" \
...@@ -219,7 +222,7 @@ FROM builder as staging ...@@ -219,7 +222,7 @@ FROM builder as staging
# Garbage collect in environment # Garbage collect in environment
RUN cd /opt/spack-environment \ RUN cd /opt/spack-environment \
&& source $SPACK_ROOT/share/spack/setup-env.sh \ && source $SPACK_ROOT/share/spack/setup-env.sh \
&& spack env activate . \ && spack env activate --dir /opt/spack-environment/${ENV} \
&& spack gc -y && spack gc -y
# Garbage collect in git # Garbage collect in git
......
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment