From b299daac0fca22fd3fd1519337aee3db6827c452 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 11:46:08 -0600 Subject: [PATCH 01/15] Create GitHub Actions workflow to build and push Docker Images --- .github/workflows/docker.yaml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 00000000..1e634c9a --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,48 @@ +name: Build and Push Docker Images + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-latest + + strategy: + matrix: + image: + - name: base + dockerfile: ./images/Dockerfile + - name: matlab + dockerfile: ./images/Dockerfile.matlab + - name: gpu + dockerfile: ./images/Dockerfile + - name: gpu-matlab + dockerfile: ./images/Dockerfile + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ vars.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker Image + uses: docker/build-push-action@v6 + with: + context: . + file: ${{ matrix.dockerfile }} + push: true + tags: | + ${{ vars.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.name }} \ No newline at end of file From 88544673e8f998173204070f746c013f18c625af Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 11:52:25 -0600 Subject: [PATCH 02/15] Update username --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 1e634c9a..4ca037cd 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -29,7 +29,7 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ vars.DOCKER_USERNAME }} + username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Set up QEMU @@ -45,4 +45,4 @@ jobs: file: ${{ matrix.dockerfile }} push: true tags: | - ${{ vars.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.name }} \ No newline at end of file + ${{ secrets.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.name }} \ No newline at end of file From ac0918f75a4e034a6043c2008c5f01077482949c Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 11:54:29 -0600 Subject: [PATCH 03/15] Fix filenames --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4ca037cd..5b8867c7 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -19,9 +19,9 @@ jobs: - name: matlab dockerfile: ./images/Dockerfile.matlab - name: gpu - dockerfile: ./images/Dockerfile + dockerfile: ./images/Dockerfile.gpu - name: gpu-matlab - dockerfile: ./images/Dockerfile + dockerfile: ./images/Dockerfile.gpu.matlab steps: - name: Checkout repository uses: actions/checkout@v4 From 14fa34f74a4fb8248618c2131bec6c0a22a1a88d Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 11:57:48 -0600 Subject: [PATCH 04/15] Update filepath --- .github/workflows/docker.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 5b8867c7..7f0dc789 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -15,13 +15,13 @@ jobs: matrix: image: - name: base - dockerfile: ./images/Dockerfile + dockerfile: Dockerfile - name: matlab - dockerfile: ./images/Dockerfile.matlab + dockerfile: Dockerfile.matlab - name: gpu - dockerfile: ./images/Dockerfile.gpu + dockerfile: Dockerfile.gpu - name: gpu-matlab - dockerfile: ./images/Dockerfile.gpu.matlab + dockerfile: Dockerfile.gpu.matlab steps: - name: Checkout repository uses: actions/checkout@v4 @@ -42,7 +42,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - file: ${{ matrix.dockerfile }} + file: ./images/${{ matrix.dockerfile }} push: true tags: | ${{ secrets.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.name }} \ No newline at end of file From 80e8dc3179ce3ce883b9f70540b4924e1eccf3ae Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 12:00:41 -0600 Subject: [PATCH 05/15] Update context --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 7f0dc789..2db1c50a 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -41,8 +41,8 @@ jobs: - name: Build and push Docker Image uses: docker/build-push-action@v6 with: - context: . - file: ./images/${{ matrix.dockerfile }} + context: images + file: images/${{ matrix.dockerfile }} push: true tags: | ${{ secrets.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.name }} \ No newline at end of file From 0214e3c297b01b9595350ec404a5eb5a5bee7b99 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 12:05:17 -0600 Subject: [PATCH 06/15] Update context --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 2db1c50a..40be6c1c 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -42,7 +42,7 @@ jobs: uses: docker/build-push-action@v6 with: context: images - file: images/${{ matrix.dockerfile }} + file: ${{ matrix.dockerfile }} push: true tags: | ${{ secrets.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.name }} \ No newline at end of file From 5c36dacbc33b17e7356fe9e12298d8308d493283 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 12:27:56 -0600 Subject: [PATCH 07/15] Fix tag --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 40be6c1c..981f54d0 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -45,4 +45,4 @@ jobs: file: ${{ matrix.dockerfile }} push: true tags: | - ${{ secrets.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.name }} \ No newline at end of file + ${{ secrets.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.image.name }} \ No newline at end of file From 9b37357e0e63ce320ca7db2a1fed65e3ef377a46 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 13:00:57 -0600 Subject: [PATCH 08/15] Update image tags to use `base` suffix --- envs/shared/jupyterhub.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/envs/shared/jupyterhub.yaml b/envs/shared/jupyterhub.yaml index 5a3e3ed9..a114f5cf 100755 --- a/envs/shared/jupyterhub.yaml +++ b/envs/shared/jupyterhub.yaml @@ -50,7 +50,7 @@ singleuser: display_name: "Standard" default: true kubespawner_override: - image: "${singleuser_image_repo}:${singleuser_image_tag}" + image: "${singleuser_image_repo}:${singleuser_image_tag}-base" kubespawner_override: image_pull_policy: Always cpu_limit: 2 @@ -69,7 +69,7 @@ singleuser: # display_name: "Standard" # default: true # kubespawner_override: - # image: "${singleuser_image_repo}:${singleuser_image_tag}" + # image: "${singleuser_image_repo}:${singleuser_image_tag}-base" # matlab: # display_name: "MATLAB (must provide your own license)" # kubespawner_override: @@ -93,7 +93,7 @@ singleuser: display_name: "Standard" default: true kubespawner_override: - image: "${singleuser_image_repo}:${singleuser_image_tag}" + image: "${singleuser_image_repo}:${singleuser_image_tag}-base" matlab: display_name: "MATLAB (must provide your own license)" kubespawner_override: @@ -118,7 +118,7 @@ singleuser: display_name: "Standard" default: true kubespawner_override: - image: "${singleuser_image_repo}:${singleuser_image_tag}" + image: "${singleuser_image_repo}:${singleuser_image_tag}-base" matlab: display_name: "MATLAB (must provide your own license)" kubespawner_override: @@ -141,7 +141,7 @@ singleuser: display_name: "Standard" default: true kubespawner_override: - image: "${singleuser_image_repo}:${singleuser_image_tag}" + image: "${singleuser_image_repo}:${singleuser_image_tag}-base" matlab: display_name: "MATLAB (must provide your own license)" kubespawner_override: From 677e40821c1650aabacfadfedff863cca118a069 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 14:16:40 -0600 Subject: [PATCH 09/15] Use token --- .github/workflows/docker.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 981f54d0..391f04ad 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -30,7 +30,7 @@ jobs: uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} + password: ${{ secrets.DOCKER_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 7e05432cf8c502a8cdf55eeccdd540c26c0d0dcf Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 14:31:18 -0600 Subject: [PATCH 10/15] Update secret names --- .github/workflows/docker.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 391f04ad..c48f451b 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -29,8 +29,8 @@ jobs: - name: Log in to Docker Hub uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -45,4 +45,4 @@ jobs: file: ${{ matrix.dockerfile }} push: true tags: | - ${{ secrets.DOCKER_USERNAME }}/dandihub:latest-${{ matrix.image.name }} \ No newline at end of file + ${{ secrets.DOCKERHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }} \ No newline at end of file From 8fc30b20bbafede8ca2c65108d83e59c5cd75f7d Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 14:42:10 -0600 Subject: [PATCH 11/15] Rename file --- .github/workflows/{docker.yaml => docker-push.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{docker.yaml => docker-push.yaml} (100%) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker-push.yaml similarity index 100% rename from .github/workflows/docker.yaml rename to .github/workflows/docker-push.yaml From 98d7bb14dd4c9124a9c21b82ce0b5213da01187d Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 14:46:14 -0600 Subject: [PATCH 12/15] Add workflow for testing --- .github/workflows/docker-push.yaml | 3 +-- .github/workflows/docker-test.yaml | 37 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker-test.yaml diff --git a/.github/workflows/docker-push.yaml b/.github/workflows/docker-push.yaml index c48f451b..4b03ae6e 100644 --- a/.github/workflows/docker-push.yaml +++ b/.github/workflows/docker-push.yaml @@ -1,14 +1,13 @@ name: Build and Push Docker Images on: - pull_request: push: branches: - main workflow_dispatch: jobs: - docker: + docker-push: runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/docker-test.yaml b/.github/workflows/docker-test.yaml new file mode 100644 index 00000000..339e7ba8 --- /dev/null +++ b/.github/workflows/docker-test.yaml @@ -0,0 +1,37 @@ +name: Build Docker Images + +on: + pull_request: + workflow_dispatch: + +jobs: + docker-test: + runs-on: ubuntu-latest + + strategy: + matrix: + image: + - name: base + dockerfile: Dockerfile + - name: matlab + dockerfile: Dockerfile.matlab + - name: gpu + dockerfile: Dockerfile.gpu + - name: gpu-matlab + dockerfile: Dockerfile.gpu.matlab + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker Image + uses: docker/build-push-action@v6 + with: + context: images + file: ${{ matrix.dockerfile }} + push: false \ No newline at end of file From 2ee929aa92645ef25a9698b4511b964de22c47cf Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 21:58:42 -0600 Subject: [PATCH 13/15] Add caching mechanism --- .github/workflows/docker-push.yaml | 4 +++- .github/workflows/docker-test.yaml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-push.yaml b/.github/workflows/docker-push.yaml index 4b03ae6e..29505ed9 100644 --- a/.github/workflows/docker-push.yaml +++ b/.github/workflows/docker-push.yaml @@ -44,4 +44,6 @@ jobs: file: ${{ matrix.dockerfile }} push: true tags: | - ${{ secrets.DOCKERHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }} \ No newline at end of file + ${{ secrets.DOCKERHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }} + cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }} + cache-to: type=inline \ No newline at end of file diff --git a/.github/workflows/docker-test.yaml b/.github/workflows/docker-test.yaml index 339e7ba8..59ccdc3e 100644 --- a/.github/workflows/docker-test.yaml +++ b/.github/workflows/docker-test.yaml @@ -34,4 +34,6 @@ jobs: with: context: images file: ${{ matrix.dockerfile }} - push: false \ No newline at end of file + push: false + cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/dandihub:latest-${{ matrix.image.name }} + cache-to: type=inline \ No newline at end of file From 1db250aa4118fb20a49f57eebc2af54276f4c29e Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 22:15:01 -0600 Subject: [PATCH 14/15] Add path filtering --- .github/workflows/docker-push.yaml | 2 ++ .github/workflows/docker-test.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/docker-push.yaml b/.github/workflows/docker-push.yaml index 29505ed9..b0632695 100644 --- a/.github/workflows/docker-push.yaml +++ b/.github/workflows/docker-push.yaml @@ -4,6 +4,8 @@ on: push: branches: - main + paths: + - 'Dockerfile*' workflow_dispatch: jobs: diff --git a/.github/workflows/docker-test.yaml b/.github/workflows/docker-test.yaml index 59ccdc3e..51cb69c5 100644 --- a/.github/workflows/docker-test.yaml +++ b/.github/workflows/docker-test.yaml @@ -2,6 +2,8 @@ name: Build Docker Images on: pull_request: + paths: + - 'Dockerfile*' workflow_dispatch: jobs: From 409599e66372d32905feb3d6b965b888e9492f23 Mon Sep 17 00:00:00 2001 From: Kabilar Gunalan Date: Wed, 11 Dec 2024 22:16:15 -0600 Subject: [PATCH 15/15] Fix syntax --- .github/workflows/docker-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-test.yaml b/.github/workflows/docker-test.yaml index 51cb69c5..81f1a694 100644 --- a/.github/workflows/docker-test.yaml +++ b/.github/workflows/docker-test.yaml @@ -2,8 +2,8 @@ name: Build Docker Images on: pull_request: - paths: - - 'Dockerfile*' + paths: + - 'Dockerfile*' workflow_dispatch: jobs: