diff --git a/README.md b/README.md index 6d190d2..c1db217 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Run `docker pull :` to retrieve the desired image. | Image | Version | `docker pull` command | Usage guide | |:-----:|:-------:|:-------------------------------------:|:------------------:| | CLM5 | 0.4 | `docker pull hpscterrsys/clm5:latest` | [link][clm5-usage] | -| eCLM | 0.1 | `docker pull hpscterrsys/eclm:latest` | [link][eclm-usage] | +| eCLM | 0.2 | `docker pull hpscterrsys/eclm:latest` | [link][eclm-usage] | [HPSCTerrSys DockerHub repository]: https://hub.docker.com/u/hpscterrsys diff --git a/eclm/Dockerfile b/eclm/Dockerfile old mode 100644 new mode 100755 index 5046c55..437ac68 --- a/eclm/Dockerfile +++ b/eclm/Dockerfile @@ -1,67 +1,62 @@ # escape=` -FROM centos:8.4.2105 +FROM ubuntu:24.04 -# Image metadata for documentation purposes. Has no effect on docker build behavior. -LABEL ` - org.label-schema.schema-version="1.0" ` - org.label-schema.name="eCLM" ` - org.label-schema.version="0.1" ` - org.label-schema.vendor="IBG-3" ` - org.label-schema.license="GPLv2" ` - org.label-schema.build-date="2021-09-27" ` - eclm.version.major="alpha" ` - eclm.env.compiler="GCC" ` - eclm.env.compiler.version="8.4.1-1" ` - eclm.env.mpi="OpenMPI" ` - eclm.env.mpi.version="4.0.5" ` - eclm.env.cmake.version="3.18.2" ` - eclm.env.pnetcdf.version="1.12.1" ` - eclm.env.netcdf-c.version="4.7.0" ` - eclm.env.netcdf-fortran.version="4.5.2" +# +# TODO: Specify image metadata following OCI format spec: https://github.com/opencontainers/image-spec/blob/main/spec.md +# +# LABEL ... -# Install required packages from base repo -RUN dnf update -y ` - && dnf group install -y "Development Tools" ` - && dnf install -y glibc-langpack-en libcurl-devel ` - man-db man-pages passwd sudo vim wget which tree ` - python39 python39-pip cmake` - epel-release ` - && dnf config-manager --set-enabled powertools ` - ` -# Install required packages from EPEL and SCL repos - && dnf install -y hdf5-devel lapack-devel openssl-devel ` - openmpi openmpi-devel ` - netcdf-devel netcdf-fortran netcdf-fortran-devel ` - && dnf clean all ` - ` -# Add python symlinks to /usr/local - && python3 -m pip install --upgrade pip ` - && ln -s /usr/bin/python3 /usr/local/bin/python +# Download compiler toolchain and libraries +RUN <> /home/clmuser/.bash_profile ` - && echo "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig" >> /home/clmuser/.bash_profile ` - && echo "export CC=mpicc" >> /home/clmuser/.bash_profile ` - && echo "export FC=mpifort" >> /home/clmuser/.bash_profile ` - && echo "alias ll='ls -phAlv'" >> /home/clmuser/.bash_profile -USER clmuser -WORKDIR /home/clmuser +USER root +WORKDIR /root CMD ["/bin/bash","-l"] diff --git a/eclm/Dockerfile_dev b/eclm/Dockerfile_dev new file mode 100755 index 0000000..5660c82 --- /dev/null +++ b/eclm/Dockerfile_dev @@ -0,0 +1,32 @@ +# escape=` +FROM hpscterrsys/eclm:0.2 + +# +# TODO: Specify image metadata following OCI format spec: https://github.com/opencontainers/image-spec/blob/main/spec.md +# +# LABEL ... + + +# Install dev tools +RUN <> .bash_profile +echo "export OMPI_ALLOW_RUN_AS_ROOT=1" >> .bash_profile +echo "export OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1" >> .bash_profile +echo "export PIP_BREAK_SYSTEM_PACKAGES=1" >> .bash_profile +echo "export CMAKE_INSTALL_PREFIX=/root/.local" >> .bash_profile +echo "export LD_LIBRARY_PATH=/usr/local/lib:/root/.local/lib" >> .bash_profile +echo "export PATH=${PATH}:/root/.local/bin" >> .bash_profile +echo "export SW=/root/.local" >> .bash_profile +echo "export EDITOR=vim" >> .bash_profile +mkdir -vp .local/{bin,lib} +EOF +CMD ["/bin/bash","-l"] diff --git a/eclm/README.md b/eclm/README.md old mode 100644 new mode 100755 index 99e06f0..1da58b7 --- a/eclm/README.md +++ b/eclm/README.md @@ -1,17 +1,83 @@ -## Manual build steps +# eCLM Docker Build Guide -1. Build Docker image +This guide requires [Podman](https://docs.podman.io/en/v4.6.1/index.html). If you're on Debian/Ubuntu, run ```sh -IMG_VERSION="0.1" -docker build --tag hpscterrsys/eclm:latest --tag hpscterrsys/eclm:$IMG_VERSION . +sudo apt update +sudo apt-get install -y podman ``` -2. Commit image to DockerHub +Otherwise, head over to the [Podman install guide](http://podman.io/docs/installation) and follow the instructions +specific to your system. + +## Building the eCLM container + +> [!NOTE] +> This section is only relevant for developers who have push access rights to the [HPSCTerrSys DockerHub](https://hub.docker.com/u/hpscterrsys). + +1. Build eCLM base image. + +```sh +podman build --tag hpscterrsys/eclm:latest --tag hpscterrsys/eclm:0.2 . +``` + +2. Push eCLM base image to DockerHub. + +```sh +podman login --username $USER docker.io +podman push hpscterrsys/eclm:latest +podman push hpscterrsys/eclm:0.2 +``` + +3. Build eCLM dev image. + +```sh +podman build --tag hpscterrsys/eclm:latest-dev --tag hpscterrsys/eclm:0.2-dev -f Dockerfile_dev +``` + +4. Push eCLM dev image to DockerHub. + +```sh +podman push hpscterrsys/eclm:latest-dev +podman push hpscterrsys/eclm:0.2-dev +podman logout +``` + +## Using the container image for local development + +First we configure file sharing between the host machine and the container image. Decide which +local folder you'd like to expose to the container image, then save its full path to `WORKDIR`: ```sh -docker login -docker push hpscterrsys/eclm:latest -docker push hpscterrsys/eclm:$IMG_VERSION -docker logout +WORKDIR=/home/user/shared_folder ``` + +Then create a container named `eclm-dev`. + +```sh +podman run --name eclm-dev -it -v ${WORKDIR}:/root/$(basename ${WORKDIR}) hpscterrsys/eclm:latest-dev +``` + +The command above will also start `eclm-dev`. Verify that everything works by running these commands: + +```sh +root@e06d13d06436:~# pwd # $HOME directory +/root +root@e06d13d06436:~# ls # Should see your WORKDIR here +shared_folder +root@e06d13d06436:~# echo $CC $FC $CXX # Preset compilers in this dev image +mpicc mpif90 mpicxx +``` + +If the container has been stopped, simply run `podman start -ai eclm-dev` to restart it. `podman run` is only done once, *i.e.* during +container creation. It's also important to know these commands: + +- `podman ps -a`: list created containers +- `podman images`: list downloaded images +- `podman rm`: Delete existing container +- `podman rmi`: Delete existing image + +The mentioned `podman` commands are sufficient to manage your local `eclm-dev` image. For more information regarding `podman` usage, visit the [Podman tutorial](https://docs.podman.io/en/v4.6.1/Tutorials.html). + + +