-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
166 additions
and
422 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}"] |
Oops, something went wrong.