Skip to content

Build and release tvb-run Docker images #133

Build and release tvb-run Docker images

Build and release tvb-run Docker images #133

name: Build and release tvb-run Docker images
on:
schedule:
- cron: '0 0 * * *' # Run every day at midnight UTC
workflow_dispatch: # Allow manual run
workflow_call: # Allow other GitHub workflows to call this
inputs:
invoked_by:
required: true
type: string
tag:
required: true
type: string
env:
DOCKER_IMAGE_NAME: thevirtualbrain/tvb-run
DOCKER_EBRAINS_REGISTRY: docker-registry.ebrains.eu
DOCKER_IMAGE_NAME_EBRAINS: docker-registry.ebrains.eu/tvb/tvb-run
jobs:
build:
name: Build and Push Docker images
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Login to EBRAINS Docker Registry
id: login_ebrains
uses: docker/login-action@v3
continue-on-error: true
with:
registry: ${{ env.DOCKER_EBRAINS_REGISTRY }}
username: ${{ secrets.EBRAINS_DOCKER_HUB_USERNAME }}
password: ${{ secrets.EBRAINS_DOCKER_HUB_PASSWORD }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
- name: Prepare TVB online help
run: |
python3 -m pip install sphinx
cd tvb_library
python3 -m pip install -e .
cd ../tvb_bin
python3 -m pip install -e .
cd ../tvb_build
python3 build_step1.py True
- name: Prepare tag for Docker image
# At release time, the tag will be given as input
# For intermediate builds, an alfa tag will be generated eg: branch_name.alpha
id: get_tag
run: |
if ${{ inputs.invoked_by == 'release' }}; then
echo "TAG=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "TAG=${{ github.ref_name }}.alpha" >> $GITHUB_OUTPUT
fi
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: tvb_build/docker
file: tvb_build/docker/Dockerfile-run
push: true
build-args: |
LAST_SHA=${{ github.sha }}
tags: |
${{ env.DOCKER_IMAGE_NAME }}:${{ steps.get_tag.outputs.TAG }}
${{ env.DOCKER_IMAGE_NAME }}:latest
- name: Push to EBRAINS registry
if: steps.login_ebrains.outcome == 'success'
run: |
docker tag ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.get_tag.outputs.TAG }} ${{ env.DOCKER_IMAGE_NAME_EBRAINS }}:${{ steps.get_tag.outputs.TAG }}
docker push ${{ env.DOCKER_IMAGE_NAME_EBRAINS }}:${{ steps.get_tag.outputs.TAG }}