-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update docker image build to use micromamba and garbage collection to…
… reduce image size
- Loading branch information
EC2 Default User
committed
Jan 4, 2024
1 parent
9b8bc39
commit c6e86a8
Showing
9 changed files
with
46 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
11 changes: 0 additions & 11 deletions
11
resources/containers/base-image/install-scripts/install-conda.sh
This file was deleted.
Oops, something went wrong.
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
19 changes: 19 additions & 0 deletions
19
resources/containers/base-image/install-scripts/install-micromamba.sh
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,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This component installs micromamba | ||
# which is smaller and faster than conda | ||
MicromambaInstallURL="https://micro.mamba.pm/api/micromamba/linux-64/latest" | ||
yum install -y bzip2 tar | ||
mkdir -p /opt/micromamba/bin/ | ||
curl -Ls $MicromambaInstallURL | tar -xvj bin/micromamba | ||
mv bin/micromamba /opt/micromamba/bin/micromamba | ||
rm -rf bin | ||
|
||
# Configuration in bashrc file | ||
echo "export MAMBA_ROOT_PREFIX=/opt/micromamba" >> /etc/bashrc | ||
echo 'eval "$(/opt/micromamba/bin/micromamba shell hook -s posix)"' >> /etc/bashrc | ||
|
||
# set alias to use conda and micromamba interchangeably | ||
echo "alias conda='micromamba'" >> /etc/bashrc |
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 |
---|---|---|
|
@@ -5,7 +5,8 @@ set -x | |
set -e # exit 1 if error | ||
|
||
# Spack version to install | ||
SpackVersion="v0.21.0" | ||
# TODO: replace with SpackVersion="v0.22.0" when released | ||
SpackVersion="561da58cea1475927b22b95aa7a6b567ef1105f3" | ||
# Spack install spec for desired compiler | ||
SpackCompiler="[email protected]" | ||
# Name of spack env | ||
|
@@ -15,6 +16,10 @@ SpackEnvironmentFile="geoschem_deps-gnu-openmpi-102.yaml" | |
# InstallSpack | ||
source /etc/bashrc | ||
|
||
# Spack needs python 3.6 or higher | ||
micromamba create -n py39 python=3.9.1 -c anaconda | ||
micromamba activate py39 | ||
|
||
yum install -y git curl curl-devel texinfo | ||
yum groupinstall -y "Development tools" | ||
umask 022 | ||
|
@@ -30,6 +35,7 @@ spack install --fail-fast $SpackCompiler | |
spack load $SpackCompiler | ||
spack compiler find --scope system | ||
|
||
# Add spack setup to bashrc | ||
# Add spack setup to bashrc ensuring we activate py39 first | ||
echo "micromamba activate py39" >> /etc/bashrc | ||
echo "export SPACK_ROOT=/opt/spack" >> /etc/bashrc | ||
echo . /opt/spack/share/spack/setup-env.sh >> /etc/bashrc |
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