Skip to content

Docker Image

Docker Image #4

Workflow file for this run

name: Build and Publish the Docker Image
on:
workflow_dispatch:
inputs:
publish:
type: boolean
description: Publish the image to the GitHub Container Registry
required: true
default: true
tag:
type: string
description: The tag to use for the image
required: true
default: latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: ghcr.io/lobis/geant4:${{ github.event.inputs.tag }}
jobs:
docker-image:
timeout-minutes: 30
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Log in to the GitHub Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CONTAINER_REGISTRY_GITHUB_TOKEN }}
- name: Build Docker image
uses: docker/build-push-action@v3
with:
context: .
push: false
tags: |
${{ env.IMAGE_NAME }}
labels: |
maintainer.name=Luis Antonio Obis Aparicio
maintainer.email=luis.antonio.obis@gmail.com
org.opencontainers.image.source=${{ github.repository }}
- name: Test image
run: |
docker run --rm ${{ env.IMAGE_NAME }} -c 'from geant4 import Application; Application().setup_manager()'
- name: Publish
run: docker push ${{ env.IMAGE_NAME }}
if: ${{ github.event.inputs.publish }}