Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracular #23

Merged
merged 22 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Update the following line to match the base ubuntu image
type=raw,value=oracular
type=sha
labels: |
org.opencontainers.image.title=Chaste Base Image
Expand Down
55 changes: 23 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# docker build --target base -t chaste/base . # Alternative: build base image
# docker run -it --rm -v chaste_data:/home/chaste chaste

ARG BASE=jammy
ARG BASE=oracular
FROM ubuntu:${BASE} AS base
LABEL maintainer="Ben Evans <ben.d.evans@gmail.com>" \
author.orcid="https://orcid.org/0000-0002-1734-6070" \
Expand Down Expand Up @@ -32,41 +32,33 @@ RUN apt-get update && \
sudo \
wget

# Add signing key to install GitHub CLI
# https://github.com/cli/cli/blob/trunk/docs/install_linux.md
# Add signing key to install GitHub CLI: https://github.com/cli/cli/blob/trunk/docs/install_linux.md
RUN wget -O /etc/apt/keyrings/github-cli.gpg https://cli.github.com/packages/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/github-cli.gpg] https://cli.github.com/packages stable main" >> /etc/apt/sources.list.d/github-cli.list

# Declare BASE in this build stage (the value is inherited from the global stage)
# https://github.com/moby/moby/issues/34482
# Declare BASE in this build stage (the value is inherited from the global stage): https://github.com/moby/moby/issues/34482
ARG BASE
# Install the Chaste repo list and key
# https://chaste.github.io/docs/installguides/ubuntu-package/
# Install the Chaste repo list and key: https://chaste.github.io/docs/installguides/ubuntu-package/
RUN wget -O /usr/share/keyrings/chaste.asc https://chaste.github.io/chaste.asc \
&& echo "deb [signed-by=/usr/share/keyrings/chaste.asc] https://chaste.github.io/ubuntu ${BASE}/" >> /etc/apt/sources.list.d/chaste.list

# https://github.com/Chaste/dependency-modules/wiki
# https://github.com/Chaste/infrastructure-scripts/blob/main/debian-package/debian/control
# https://github.com/Chaste/ubuntu/tree/main/debs
# Package: chaste-dependencies
# Version: 2022.04.11
# Version: 2024.10.28
# Architecture: all
# Depends: cmake | scons, g++, libopenmpi-dev, petsc-dev, libhdf5-openmpi-dev, xsdcxx, libboost-serialization-dev, libboost-filesystem-dev, libboost-program-options-dev, libparmetis-dev, libmetis-dev, libxerces-c-dev, libsundials-dev, libvtk7-dev | libvtk6-dev, python3, python3-venv
# Recommends: git, valgrind, libpetsc-real3.15-dbg | libpetsc-real3.14-dbg | libpetsc-real3.12-dbg, libfltk1.1, hdf5-tools, cmake-curses-gui
# Suggests: libgoogle-perftools-dev, doxygen, graphviz, subversion, git-svn, gnuplot, paraview
# DEPRECATED: scons will be removed in the next release
# Depends: cmake, g++, git, libopenmpi-dev, petsc-dev, libhdf5-openmpi-dev, xsdcxx, libboost-serialization-dev, libboost-filesystem-dev, libboost-program-options-dev, libparmetis-dev, libmetis-dev, libxerces-c-dev, libsundials-dev, libvtk9-dev (>= 9.3.0), python3, python3-venv
# Recommends: valgrind, libpetsc-real3.20-dbg|libpetsc-real3.19t64-dbg|libpetsc-real3.18-dbg|libpetsc-real3.15-dbg, hdf5-tools, cmake-curses-gui, doxygen, graphviz, gnuplot, paraview

# Install dependencies with recommended, applicable suggested and other useful packages
# Install dependencies with applicable recommended and other useful packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
chaste-dependencies \
cmake \
clang \
lldb \
gdb \
# libvtk7-dev \ # Dependency of chaste-dependencies (check 7 not 6 is installed)
python3-dev \
python3-pip \
gh \
git \
valgrind \
"libpetsc-real*-dbg" \
hdf5-tools \
Expand All @@ -75,17 +67,11 @@ RUN apt-get update && \
graphviz && \
rm -rf /var/lib/apt/lists/*

# Fix libexpat1 version for jammy: https://github.com/Chaste/Chaste/issues/249
RUN apt-get update && \
apt-get install -y --allow-downgrades libexpat1=2.4.7-1 libexpat1-dev=2.4.7-1 && \
apt-mark hold libexpat1 libexpat1-dev && \
rm -rf /var/lib/apt/lists/*

# Update system to use Python3 by default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \
update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# Fix CMake warnings: https://github.com/autowarefoundation/autoware/issues/795 TODO: Check if this is still necessary with VTK9
RUN update-alternatives --install /usr/bin/vtk vtk /usr/bin/vtk7 7
# RUN update-alternatives --install /usr/bin/vtk vtk /usr/bin/vtk9 1

# Set environment variables with args to allow for changes at build time
ARG USER="chaste"
Expand All @@ -104,9 +90,10 @@ ENV USER=${USER} \
CHASTE_SOURCE_DIR="${CHASTE_DIR}/src" \
CHASTE_BUILD_DIR="${CHASTE_DIR}/build" \
CHASTE_TEST_OUTPUT="${CHASTE_DIR}/output" \
PATH="${CHASTE_DIR}/scripts:${PATH}" \
TEXTTEST_HOME=/usr/local/bin/texttest
PATH="${CHASTE_DIR}/scripts:${PATH}"
# TEXTTEST_HOME=/usr/local/bin/texttest
ENV CHASTE_PROJECTS_DIR="${CHASTE_SOURCE_DIR}/projects" \
TEXTTEST_HOME="${CHASTE_BUILD_DIR}/texttest_venv" \
PYTHONPATH="${CHASTE_BUILD_DIR}/python"

# Create user and working directory for Chaste files
Expand All @@ -119,18 +106,22 @@ COPY --chown=${USER}:${GROUP} scripts "${CHASTE_DIR}/scripts"

USER ${USER}
WORKDIR ${CHASTE_DIR}
# SHELL [ "/bin/bash", "-exo", "pipefail", "-c" ]

# Install TextTest for regression testing (requires pygtk)
# NOTE: chaste-codegen is installed by CMake
RUN python -m pip install --no-cache-dir --upgrade pip && \
RUN python -m venv --upgrade-deps "${CHASTE_BUILD_DIR}/texttest_venv" && \
# source "${CHASTE_BUILD_DIR}/texttest_venv/bin/activate" && \
. "${CHASTE_BUILD_DIR}/texttest_venv/bin/activate" && \
# PATH=".local:${PATH}" && \
python -m pip install --no-cache-dir texttest

# Create Chaste src, build, output and projects folders
RUN mkdir -p "${CHASTE_SOURCE_DIR}" "${CHASTE_BUILD_DIR}" "${CHASTE_TEST_OUTPUT}" && \
ln -s "${CHASTE_PROJECTS_DIR}" projects
# DEPRECATED: Transitionary symlinks for build and output directories
RUN ln -s "${CHASTE_BUILD_DIR}" lib && \
ln -s "${CHASTE_TEST_OUTPUT}" testoutput
# RUN ln -s "${CHASTE_BUILD_DIR}" lib && \
# ln -s "${CHASTE_TEST_OUTPUT}" testoutput

# Fix git permissions issue CVE-2022-24765
RUN git config --global --add safe.directory "${CHASTE_SOURCE_DIR}"
Expand Down
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ help:
@echo "Perform a dry run with:"
@echo " make [TARGET] -n"

BASE ?= jammy
GIT_TAG ?= 2024.1

BASE ?= oracular
GIT_TAG ?= 2024.2
TEST_SUITE ?= -
CHASTE_IMAGE ?= chaste/release
CHASTE_DIR ?= "/home/chaste"
CHASTE_DATA_VOLUME ?= chaste_data
FRESH ?=
OUT ?= auto
FRESH ?=
EXTRA_BUILD_FLAGS ?=

# Optional mounts
# PROJECTS ?= "${HOME}/projects"
# TEST_OUTPUT ?= "${HOME}/output"


# https://github.com/pytorch/pytorch/blob/main/docker.Makefile
MULTI_ARCH_BUILD ?= true
ifeq ("$(MULTI_ARCH_BUILD)", "true")
Expand Down Expand Up @@ -67,14 +69,14 @@ develop main release: BUILD_ARGS += --build-arg GIT_TAG=$(GIT_TAG) \
--build-arg TEST_SUITE=$(TEST_SUITE)

develop main: CMAKE_BUILD_TYPE="Debug"
develop main: Chaste_ERROR_ON_WARNING="ON"
develop main: Chaste_ERROR_ON_WARNING ?= "ON"
develop main: Chaste_UPDATE_PROVENANCE="OFF"
develop main: GIT_TAG=$@

release: CMAKE_BUILD_TYPE="Release"
release: Chaste_ERROR_ON_WARNING="OFF"
release: Chaste_ERROR_ON_WARNING ?= "OFF"
release: Chaste_UPDATE_PROVENANCE="ON"
release: TEST_SUITE="Continuous"
# release: TEST_SUITE = "Continuous"

base develop main release: CHASTE_IMAGE = chaste/$@
base develop main release: DOCKER_TAGS = -t $(CHASTE_IMAGE)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Install [Docker](https://www.docker.com/products/docker-desktop/) and configure
```
docker run --init -it --rm -v chaste_data:/home/chaste chaste/release
```
If needed, you can also specify an [available tag](https://hub.docker.com/r/chaste/release/tags) in the image name in the form `chaste/release:<tag>` to pull a particular release (e.g. `chaste/release:2024.1`) rather than defaulting to the latest version.
If needed, you can also specify an [available tag](https://hub.docker.com/r/chaste/release/tags) in the image name in the form `chaste/release:<tag>` to pull a particular release (e.g. `chaste/release:2024.2`) rather than defaulting to the latest version.
2. Alternatively, if you want to use the latest development code from the `develop` branch, use this command to pull and run the latest `chaste/develop` image instead:
```
docker run --init -it --rm -v chaste_data:/home/chaste chaste/develop
Expand Down Expand Up @@ -147,7 +147,7 @@ For further details and illustrations of the Docker mount options see the [stora

### Bind mounts

Any host directory (specified with an absolute path e.g. `/path/to/output`) may be mounted in the container e.g. the `output` directory. Alternatively, navigate to the folder on the host which contains these directories e.g. `C:\Users\$USERNAME\chaste` (Windows) or `~/chaste` (Linux/macOS) and use `$(pwd)/output` instead as shown below. In the following examples, the image name (final argument) is assumed to be `chaste/release` rather than e.g. `chaste/develop` or `chaste/release:2024.1` for simplicity.
Any host directory (specified with an absolute path e.g. `/path/to/output`) may be mounted in the container e.g. the `output` directory. Alternatively, navigate to the folder on the host which contains these directories e.g. `C:\Users\$USERNAME\chaste` (Windows) or `~/chaste` (Linux/macOS) and use `$(pwd)/output` instead as shown below. In the following examples, the image name (final argument) is assumed to be `chaste/release` rather than e.g. `chaste/develop` or `chaste/release:2024.2` for simplicity.
```
docker run -it --init --rm -v chaste_data:/home/chaste -v "${PWD}"/output:/home/chaste/output chaste/release
```
Expand Down Expand Up @@ -222,7 +222,7 @@ If you're a more advanced developer and want to build your own image with a part
```
2. Alternatively a specific branch or tag may be specified through the argument `--build-arg GIT_TAG=<branch|tag>` (with the same tag appended onto the docker image name for clarity) e.g.:
```
docker build -t chaste:custom --build-arg GIT_TAG=2024.1 https://github.com/chaste/chaste-docker.git
docker build -t chaste:custom --build-arg GIT_TAG=2024.2 https://github.com/chaste/chaste-docker.git
```
3. Finally, if you want a bare container ready for you to clone and compile your own Chaste code, pull a `base` image with `docker pull chaste/base` (specifying an [available Ubuntu distribution](https://hub.docker.com/repository/docker/chaste/base/tags) if desired e.g. `chaste/base:focal`) Alternatively, build a fresh image by running the following command (omitting the `--build-arg GIT_TAG=<branch|tag>` argument above, or explicitly passing `--build-arg GIT_TAG=-`, which will skip compiling Chaste within the image):
```
Expand Down
Loading