Skip to content

Commit

Permalink
Merge branch 'main' into solid_viscosity_update
Browse files Browse the repository at this point in the history
  • Loading branch information
aabrown100-git authored Oct 8, 2024
2 parents 1e58948 + e1ac609 commit 1ba3f25
Show file tree
Hide file tree
Showing 4 changed files with 166 additions and 422 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/docker_solver_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
install: true

- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Log in to DockerHub as simvascular
uses: docker/login-action@v2
with:
username: simvascular
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./Docker/solver/dockerfile
push: true
tags: simvascular/solver:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

- name: Move new cache to old cache
if: always()
run: mv /tmp/.buildx-cache-new /tmp/.buildx-cache
43 changes: 43 additions & 0 deletions Docker/solver/dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Use the pre-configured image from Docker Hub as the base
FROM simvascular/libraries:ubuntu22 AS builder

# Get latest svFSIplus solver from GitHub repository
RUN git clone https://github.com/SimVascular/svFSIplus.git

# Trilinos build
WORKDIR /svFSIplus/build-trilinos
RUN cmake -DSV_USE_TRILINOS:BOOL=ON .. &&\
make -j4

# PETSc build
WORKDIR /svFSIplus/build-petsc
RUN cmake -DSV_PETSC_DIR:STRING=/petsc .. &&\
make -j4


# FINAL IMAGE with solver executable
FROM simvascular/libraries:ubuntu22 AS final

#Set arguments:
# BUILD: build type (petsc, trilinos, none)
# TASKS: number of tasks to run in parallel
# INPUT: input file to run the solver

ENV BUILD=none
ENV TASKS=2
ENV INPUT="svFSIplus.xml"

COPY --from=builder /svFSIplus/build-petsc /build-petsc
COPY --from=builder /svFSIplus/build-trilinos /build-trilinos
COPY --from=builder /svFSIplus/build-trilinos /build-none

# Set the working directory to where input files are mounted
WORKDIR /mnt

# Set entrypoint to run the solver when the container starts and checks if BUILD has the correct value
ENTRYPOINT ["sh", "-c", "\
if [ \"${BUILD}\" != \"none\" ] && [ \"${BUILD}\" != \"petsc\" ] && [ \"${BUILD}\" != \"trilinos\" ]; then \
echo \"Invalid BUILD value: ${BUILD}\" >&2; \
exit 1; \
fi; \
mpirun -n ${TASKS} /build-${BUILD}/svFSI-build/bin/svFSI ${INPUT}"]
Loading

0 comments on commit 1ba3f25

Please sign in to comment.