Docker Image #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 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-python-application:${{ 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_python_application import Application; Application().setup_manager()' | |
- name: Publish | |
run: docker push ${{ env.IMAGE_NAME }} | |
if: ${{ github.event.inputs.publish }} |