forked from mfem/mfem
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding multistage-build for slimmer container
I am currently running into an issue where when I shell inside my backspace turns into a forward space, and I am hoping someone can reproduce to determine if there is a bug we need to track down or if I am just a nut :) Signed-off-by: vsoch <[email protected]>
- Loading branch information
Showing
5 changed files
with
108 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,26 @@ | ||
FROM ghcr.io/rse-ops/cuda-ubuntu-20.04:cuda-11.0.3 | ||
FROM ghcr.io/mfem/mfem-ubuntu-base:latest as builder | ||
|
||
# docker build -t ghcr.io/mfem/mfem-ubuntu-base . | ||
# docker build -t ghcr.io/mfem/mfem-ubuntu . | ||
|
||
COPY ./spack.yaml /opt/mfem-env/spack.yaml | ||
RUN apt-get install -y python3 && \ | ||
cd /opt/mfem-env && \ | ||
. /opt/spack/share/spack/setup-env.sh && \ | ||
spack env activate . && \ | ||
spack env view regenerate | ||
|
||
FROM ubuntu:22.04 | ||
|
||
COPY --from=builder /opt/view /opt/view | ||
COPY --from=builder /opt/mfem-view /opt/mfem-view | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y unzip gfortran && \ | ||
spack compiler find && \ | ||
apt-get install -y libcurl4-openssl-dev libssl-dev | ||
|
||
# /code is the working directory for code | ||
WORKDIR /code | ||
COPY . /code | ||
|
||
# This is for a spack environment/view to install from there | ||
WORKDIR /opt/mfem-env | ||
RUN . /opt/spack/share/spack/setup-env.sh && \ | ||
spack env create -d . && \ | ||
echo " concretization: together" >> spack.yaml && \ | ||
spack env activate . && \ | ||
spack develop --path /code mfem@master+examples+miniapps && \ | ||
spack add mfem@master+examples+miniapps && \ | ||
spack install | ||
|
||
# ensure mfem always on various paths | ||
RUN cd /opt/mfem-env && \ | ||
spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh | ||
ENV PATH=$PATH:/opt/mfem-view/bin | ||
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/mfem-view/lib:/opt/mfem-view/lib64 | ||
|
||
# The user will see the view on shell into the container | ||
WORKDIR /opt/mfem-env/.spack-env/view/ | ||
ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l", "-c"] | ||
WORKDIR /opt/mfem-view | ||
ENTRYPOINT ["/bin/bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM ghcr.io/rse-ops/cuda-ubuntu-20.04:cuda-11.0.3 | ||
|
||
# docker build -f Dockerfile.base -t ghcr.io/mfem/mfem-ubuntu-base . | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y unzip gfortran && \ | ||
spack compiler find && \ | ||
apt-get install -y libcurl4-openssl-dev libssl-dev | ||
|
||
# /code is the working directory for code | ||
WORKDIR /code | ||
COPY . /code | ||
|
||
# This is for a spack environment/view to install from there | ||
RUN mkdir -p /opt/mfem-env \ | ||
&& (echo "spack:" \ | ||
&& echo " view:" \ | ||
&& echo " mfem:" \ | ||
&& echo " root: /opt/mfem-view" \ | ||
&& echo " link_type: copy" \ | ||
&& echo " packages:" \ | ||
&& echo " all:" \ | ||
&& echo " target:" \ | ||
&& echo " - x86_64_v3" \ | ||
&& echo " config:" \ | ||
&& echo " concretizer: clingo" \ | ||
&& echo " compiler:" \ | ||
&& echo " target:" \ | ||
&& echo " - x86_64_v3" \ | ||
&& echo " install_missing_compilers: true" \ | ||
&& echo " concretization: together") > /opt/mfem-env/spack.yaml | ||
|
||
RUN cd /opt/mfem-env && \ | ||
. /opt/spack/share/spack/setup-env.sh && \ | ||
spack env activate . && \ | ||
spack develop --path /code mfem@master+examples+miniapps && \ | ||
spack add mfem@master+examples+miniapps # && \ | ||
# spack install | ||
|
||
# ensure mfem always on various paths | ||
#RUN cd /opt/mfem-env && \ | ||
# spack env activate --sh -d . >> /etc/profile.d/z10_spack_environment.sh | ||
|
||
# Present the software install when we shell in | ||
# The view is at /opt/mfem-env/.spack-env/view | ||
#WORKDIR /opt/software | ||
#ENTRYPOINT ["/bin/bash", "--rcfile", "/etc/profile", "-l", "-c"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
spack: | ||
specs: [mfem@master+examples+miniapps] | ||
view: | ||
mfem: | ||
root: /opt/mfem-view | ||
link_type: copy | ||
concretization: together | ||
develop: | ||
mfem: | ||
path: /code | ||
spec: mfem@master+examples+miniapps |