Skip to content

DevOps ~ Building ABLATE Dependencies Locally

Matt McGurn edited this page Aug 3, 2023 · 8 revisions

When testing for PETSc or other dependencies api changes it is often useful to build the docker dependency file locally for testing.

  1. Install docker locally using the official docker or alternative:

  2. Build the CHREST BaseImage

    1. Clone chrest-base-image
    2. From cloned chrest-base-image directory build the chrest-base-image image
    docker buildx build . --file Dockerfile --tag=chrest-base-image-local --load
  3. Building Petsc-Docker

    1. Clone petcs-docker
    2. From cloned pets-docker directory build the petsc-docker image
    docker buildx build . --file Dockerfile --tag=petsc-build-local --build-arg CHREST_BASE_IMAGE=chrest-base-image-local --load
    1. The following build arguments can be set when building using the --build-arg argument_name=value
    Build Argument Description Example Values
    PETSC_BUILD_COMMIT the branch/commit of PETSc to build main,099c1ef3aaa
    CC c complier gcc,clang
    CXX c++ complier g++,clang++
    Index64Bit enables –with-64-bit-indices flag in PETSc 0,1
    DEBUGFLAGS optional debug build flags "-g -O0"
    OPTFLAGS optional opt build flags "-g -O"
  4. Build ABLATE Dependency Image

    1. Within the ablate directory build the ablateDepencyFile using the new petsc-build image
    docker build . --file DockerDependencyFile --tag=ablate-dependencies-local --build-arg PETSC_BASE_IMAGE=petsc-build-local
  5. Build and test ABLATE Test File

    1. Within the ablate directory build the AblateTestFile using the new dependency image
    docker build -t ablate_testing_image-local -f DockerTestFile . --build-arg ABLATE_DEPENDENCY_IMAGE=ablate-dependencies-local
    1. Run all ABLATE tests with the built image
    docker run --rm ablate_testing_image-local 
    1. Individual tests can be run using interactive docker mode
    docker run -it --rm ablate_testing_image-local /bin/bash