From 038e5213994e4ab943a25621b525e65eb20fc8ec Mon Sep 17 00:00:00 2001 From: Anthony Galassi <28850131+bendhouseart@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:45:06 -0400 Subject: [PATCH 1/4] build docker image in self hosted --- .github/workflows/docker-build.yaml | 41 +++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/docker-build.yaml diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml new file mode 100644 index 0000000..264ddeb --- /dev/null +++ b/.github/workflows/docker-build.yaml @@ -0,0 +1,41 @@ +name: Build Docker Image + +on: + workflow_dispatch: + inputs: + use_local_freesurfer: + type: boolean + description: 'Use local FreeSurfer binaries instead of downloading' + required: false + default: false + push_to_registry: + type: boolean + description: 'Push the built image to Docker registry' + required: false + default: false + push: + branches: [ main, master ] + tags: [ 'v*' ] + pull_request: + branches: [ main, master ] + +jobs: + build-docker: + runs-on: self-hosted + name: Build Docker Image + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build Docker image + run: | + make dockerbuild USE_LOCAL_FREESURFER=${{ github.event.inputs.use_local_freesurfer || 'False' }} + + - name: Push Docker image + if: github.event.inputs.push_to_registry == 'true' || startsWith(github.ref, 'refs/tags/') + run: | + make dockerpush \ No newline at end of file From 79b47def375233f46c89cc516f029b4a1844b52e Mon Sep 17 00:00:00 2001 From: Anthony Galassi <28850131+bendhouseart@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:49:35 -0400 Subject: [PATCH 2/4] remove buildx --- .github/workflows/docker-build.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 264ddeb..ca08851 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -28,9 +28,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Build Docker image run: | make dockerbuild USE_LOCAL_FREESURFER=${{ github.event.inputs.use_local_freesurfer || 'False' }} From 613bfc1599a0d0b73e834ad65641aad5b7813989 Mon Sep 17 00:00:00 2001 From: Anthony Galassi <28850131+bendhouseart@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:52:34 -0400 Subject: [PATCH 3/4] remove buildx moreso --- .github/workflows/docker-build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index ca08851..84853a1 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -30,6 +30,7 @@ jobs: - name: Build Docker image run: | + export DOCKER_BUILDKIT=0 make dockerbuild USE_LOCAL_FREESURFER=${{ github.event.inputs.use_local_freesurfer || 'False' }} - name: Push Docker image From 379cab0d556496cb75624abf017469e829599577 Mon Sep 17 00:00:00 2001 From: Anthony Galassi <28850131+bendhouseart@users.noreply.github.com> Date: Thu, 7 Aug 2025 15:55:15 -0400 Subject: [PATCH 4/4] something may have happened to this makefile --- .github/workflows/docker-build.yaml | 6 ++++++ Makefile | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-build.yaml b/.github/workflows/docker-build.yaml index 84853a1..8866a21 100644 --- a/.github/workflows/docker-build.yaml +++ b/.github/workflows/docker-build.yaml @@ -31,6 +31,12 @@ jobs: - name: Build Docker image run: | export DOCKER_BUILDKIT=0 + echo "Debug: Project name extraction:" + cat pyproject.toml | grep '^name =' | cut -d '"' -f 2 + echo "Debug: Version extraction:" + cat pyproject.toml | grep '^version =' | cut -d '"' -f 2 + echo "Debug: Full command that will be run:" + echo "docker build --build-arg=\"USE_LOCAL_FREESURFER=${{ github.event.inputs.use_local_freesurfer || 'False' }}\" -t openneuropet/$(cat pyproject.toml | grep '^name =' | cut -d '"' -f 2):$(cat pyproject.toml | grep '^version =' | cut -d '"' -f 2) ." make dockerbuild USE_LOCAL_FREESURFER=${{ github.event.inputs.use_local_freesurfer || 'False' }} - name: Push Docker image diff --git a/Makefile b/Makefile index b213466..b752c48 100644 --- a/Makefile +++ b/Makefile @@ -27,12 +27,12 @@ pythondeps: USE_LOCAL_FREESURFER ?= False dockerbuild: - docker build --build-arg="USE_LOCAL_FREESURFER=$(USE_LOCAL_FREESURFER)" -t openneuropet/$(shell cat pyproject.toml | grep name | cut -d '"' -f 2):$(shell cat pyproject.toml | grep version | head -n 1 | cut -d '"' -f 2) . - docker build --build-arg="USE_LOCAL_FREESURFER=$(USE_LOCAL_FREESURFER)" -t openneuropet/$(shell cat pyproject.toml | grep name | cut -d '"' -f 2):latest . + docker build --build-arg="USE_LOCAL_FREESURFER=$(USE_LOCAL_FREESURFER)" -t openneuropet/$(shell cat pyproject.toml | grep '^name =' | cut -d '"' -f 2):$(shell cat pyproject.toml | grep '^version =' | cut -d '"' -f 2) . + docker build --build-arg="USE_LOCAL_FREESURFER=$(USE_LOCAL_FREESURFER)" -t openneuropet/$(shell cat pyproject.toml | grep '^name =' | cut -d '"' -f 2):latest . dockerpush: dockerbuild - docker push openneuropet/$(shell cat pyproject.toml | grep name | cut -d '"' -f 2):$(shell cat pyproject.toml | grep version | head -n 1 | cut -d '"' -f 2) - docker push openneuropet/$(shell cat pyproject.toml | grep name | cut -d '"' -f 2):latest + docker push openneuropet/$(shell cat pyproject.toml | grep '^name =' | cut -d '"' -f 2):$(shell cat pyproject.toml | grep '^version =' | cut -d '"' -f 2) + docker push openneuropet/$(shell cat pyproject.toml | grep '^name =' | cut -d '"' -f 2):latest html: cd docs && make html \ No newline at end of file