Skip to content

Docker - build and deploy image #2

Docker - build and deploy image

Docker - build and deploy image #2

# This workflow is based on part of the staphb workflow at https://github.com/StaPH-B/docker-builds/blob/master/.github/workflows/build-to-deploy.yml
name: Docker - build and deploy image
on:
workflow_dispatch:
inputs:
dockerfile_name:
default: Dockerfile
required: false
type: string
version:
required: false
default: latest
type: string
jobs:
build:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/rivm-bioinformatics/skiml-cluster
tags: |
${{ inputs.version }}
- name: Build and push to ghcr.io
id: docker_build
uses: docker/build-push-action@v3
with:
context: .
file: ./${{ inputs.dockerfile_name }}
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: |
${{ steps.meta.outputs.tags }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}