From 13c5308651e6fe8a69477be6a9f0012d6aaf9fc9 Mon Sep 17 00:00:00 2001
From: Remi Gau <remi_gau@hotmail.com>
Date: Sun, 24 Mar 2024 21:39:55 -0400
Subject: [PATCH] try build docker with GHA

---
 .github/workflows/docker.yml | 77 ++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 .github/workflows/docker.yml

diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
new file mode 100644
index 000000000..e7a956189
--- /dev/null
+++ b/.github/workflows/docker.yml
@@ -0,0 +1,77 @@
+---
+on:
+  push:
+    branches:
+    - main
+    tags:
+    - '*'
+  pull_request:
+    branches:
+    - main
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+permissions:
+  contents: read
+
+jobs:
+  docker:
+    # build and test docker image
+    runs-on: ubuntu-latest
+    steps:
+    - uses: actions/checkout@v4
+    - name: Build the Docker image
+      run: |
+        user_name="bids"
+        docker build . --file Dockerfile --tag ${user_name}/bidspm
+        mkdir -p "${HOME}/docker"
+        docker save "${user_name}/bidspm" > "${HOME}/docker/image.tar"
+
+      # - name: Restore cached data ds000017
+      #   id: cache
+      #   uses: actions/cache/restore@v4
+      #   with:
+      #     path: /home/runner/work/giga_connectome/giga_connectome/giga_connectome/data/test_data
+      #     key: ds000017
+
+      # - name: Test the Docker image
+      #   run: |
+      #     docker load -i ${HOME}/docker/image.tar
+      #     docker run --rm --read-only \
+      #       -v /home/runner/work/giga_connectome/giga_connectome/giga_connectome/data/test_data:/test_data \
+      #       -v ./outputs:/outputs \
+      #       -v ./outputs/working_dir:/work \
+      #       bids/giga_connectome \
+      #       /test_data/ds000017-fmriprep22.0.1-downsampled-nosurface \
+      #       /outputs \
+      #       participant \
+      #       -w /work \
+      #       --participant_label 1 \
+      #       --reindex-bids
+
+      # - name: Upload output artifact
+      #   uses: actions/upload-artifact@v3
+      #   with:
+      #     name: connectome
+      #     path: ./outputs/
+      # - name: Upload docker image artifact
+      #   uses: actions/upload-artifact@v3
+      #   with:
+      #     name: docker-image
+      #     path: ${HOME}/docker/image.tar
+
+  # publish:
+  #   runs-on: ubuntu-latest
+  #   needs: [test-package, test-coverage]
+  #   if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
+  #   steps:
+  #   - uses: actions/download-artifact@v3
+  #     with:
+  #       name: dist
+  #       path: dist/
+  #   - uses: pypa/gh-action-pypi-publish@release/v1
+  #     with:
+  #       user: __token__
+  #       password: ${{ secrets.PYPI_API_TOKEN }}