Skip to content

Commit

Permalink
Add Singularity container recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengt900 committed Jan 30, 2024
1 parent 57ef228 commit 34cd088
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ci/docker/Dockerfile.base
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM ubuntu:22.04 as base
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update && \
apt install -y \
make \
gfortran \
git \
vim \
wget \
tcsh \
netcdf-bin \
libnetcdf-dev \
Expand All @@ -18,6 +20,3 @@ RUN mkdir -p /opt
WORKDIR /opt
RUN chown -R builder:builder /opt
USER builder

FROM base
COPY --chown=builder:builder ./exps/datasets /opt/datasets
5 changes: 5 additions & 0 deletions ci/docker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Build base image
docker build -t 1d_mom6_cobalt:base .

# run docker container image in interactive mode
docker run --mount "type=bind,source=/Users/$USER/work,target=/work" -it 1d_mom6_cobalt:base bash --login
5 changes: 5 additions & 0 deletions ci/singularity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# build singularity image
singularity build 1d_mom6_cobalt.sif ./build_1d_mom6_cobalt.def

# Run the singularity container image in interactive mode
singularity shell --fakeroot -B /home/$USER/work:/work -e 1d_mom6_cobalt.sif
37 changes: 37 additions & 0 deletions ci/singularity/build_1d_mom6_cobalt.def
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
BootStrap: docker
From: ubuntu:22.04

%environment
export DEBIAN_FRONTEND=noninteractive
export PATH=/opt/bin:$PATH

%post
apt update && \
apt install -y \
make \
vim \
curl \
wget \
imagemagick \
gfortran \
git \
tcsh \
netcdf-bin \
libnetcdf-dev \
libnetcdff-dev \
openmpi-bin \
libopenmpi-dev \
&& apt clean -y \
&& rm -rf /var/lib/apt/lists/*

mkdir -p /opt

cd /opt && git clone https://github.com/NOAA-GFDL/FRE-NCtools.git
cd /opt/FRE-NCtools && autoreconf -i && mkdir build && cd build \
&& ../configure --prefix=/opt \
&& make && make install

rm -rf /opt/FRE-NCtools

%labels
Author "Yi-cheng Teng"

0 comments on commit 34cd088

Please sign in to comment.