Added a yml file to build the docker image #2
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
name: Build and Run Docker | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, edited] | |
branches: | |
- main | |
- "docker/**" | |
jobs: | |
build-and-run-docker: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build Docker image | |
run: | | |
docker build -t tf2.4_ivim-mri_codecollection -f Docker/Dockerfile . | |
- name: Save Docker image to a tarball | |
run: | | |
docker save -o tf2.4_ivim-mri_codecollection.tar tf2.4_ivim-mri_codecollection | |
- name: Upload Docker image artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-image | |
path: tf2.4_ivim-mri_codecollection.tar | |
- name: Run Docker container | |
run: | | |
docker run --rm --name TF2.4_IVIM-MRI_CodeCollection \ | |
-v ${{ github.workspace }}:/usr/src/app \ | |
-v ${{ github.workspace }}:/usr/app/output \ | |
tf2.4_ivim-mri_codecollection brain.nii.gz brain.bvec brain.bval | |
- name: Clean up | |
run: | | |
docker rmi tf2.4_ivim-mri_codecollection | |
rm tf2.4_ivim-mri_codecollection.tar |