Skip to content

GVM Config Container Image Builds #67

GVM Config Container Image Builds

GVM Config Container Image Builds #67

name: GVM Config Container Image Builds
on:
push:
branches:
- main
tags:
- "v*"
paths:
- gvm-config/**
- .github/workflows/container-gvm-config.yml
pull_request:
branches:
- main
paths:
- gvm-config/**
- .github/workflows/container-gvm-config.yml
workflow_dispatch:
schedule:
# rebuild image every sunday
- cron: "0 0 * * 0"
permissions:
contents: read
packages: write
id-token: write
pull-requests: write
jobs:
gvm-config-images:
name: Build and upload GVM config container image
runs-on: self-hosted-generic
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Login to ghcr.io
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Greenbone Registry
uses: docker/login-action@v4
with:
registry: ${{ vars.GREENBONE_REGISTRY }}
username: ${{ secrets.GREENBONE_REGISTRY_USER }}
password: ${{ secrets.GREENBONE_REGISTRY_TOKEN }}
- name: Setup container meta information
id: meta
uses: docker/metadata-action@v6
with:
images: |
ghcr.io/greenbone/gvm-config
${{ vars.GREENBONE_REGISTRY }}/community/gvm-config
labels: |
org.opencontainers.image.vendor=Greenbone
org.opencontainers.image.documentation=https://greenbone.github.io/docs/
org.opencontainers.image.base.name=debian:stable-slim
flavor: latest=false # no latest container tag for git tags
tags: |
# create container tag for git tags
type=ref,event=tag
type=ref,event=pr
# set latest for main branch pushes
type=raw,value=latest,enable={{is_default_branch}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Build and push Container image
uses: docker/build-push-action@v7
with:
context: gvm-config
push: ${{ github.event_name != 'pull_request' }}
file: gvm-config/Dockerfile
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}