Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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: 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
if: github.event.inputs.push_to_registry == 'true' || startsWith(github.ref, 'refs/tags/')
run: |
make dockerpush
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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