Skip to content

Commit c2149da

Browse files
committed
Removed -it, and also save the docker image as an artifcat
1 parent af49849 commit c2149da

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

.github/workflows/docker-build-and-run.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ on:
55
branches:
66
- main
77
pull_request:
8+
types: [opened, synchronize, edited]
89
branches:
910
- main
11+
- "docker/**"
1012

1113
jobs:
1214
build-and-run-docker:
@@ -19,15 +21,28 @@ jobs:
1921
- name: Set up Docker Buildx
2022
uses: docker/setup-buildx-action@v3
2123

22-
# Build the Docker image
2324
- name: Build Docker image
2425
run: |
2526
docker build -t tf2.4_ivim-mri_codecollection -f Docker/Dockerfile .
2627
27-
# Run the Docker container
28+
- name: Save Docker image to a tarball
29+
run: |
30+
docker save -o tf2.4_ivim-mri_codecollection.tar tf2.4_ivim-mri_codecollection
31+
32+
- name: Upload Docker image artifact
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: docker-image
36+
path: tf2.4_ivim-mri_codecollection.tar
37+
2838
- name: Run Docker container
2939
run: |
30-
docker run -it --rm --name TF2.4_IVIM-MRI_CodeCollection \
40+
docker run --rm --name TF2.4_IVIM-MRI_CodeCollection \
3141
-v ${{ github.workspace }}:/usr/src/app \
3242
-v ${{ github.workspace }}:/usr/app/output \
3343
tf2.4_ivim-mri_codecollection brain.nii.gz brain.bvec brain.bval
44+
45+
- name: Clean up
46+
run: |
47+
docker rmi tf2.4_ivim-mri_codecollection
48+
rm tf2.4_ivim-mri_codecollection.tar

0 commit comments

Comments
 (0)