Redis Server Container Image Builds #121
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: Redis Server Container Image Builds | |
on: | |
push: | |
branches: [ main ] | |
tags: ["v*"] | |
path: | |
- redis-server/* | |
- .github/workflows/container-redis.yml | |
pull_request: | |
branches: [ main ] | |
path: | |
- redis-server/* | |
- .github/workflows/container-redis.yml | |
workflow_dispatch: | |
schedule: | |
# rebuild image every sunday | |
- cron: "0 0 * * 0" | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
pull-requests: write | |
jobs: | |
redis-images: | |
name: Build and upload redis container images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
if: github.event_name != 'pull_request' | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Setup container meta information | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: greenbone/redis-server | |
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@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Container image | |
uses: docker/build-push-action@v5 | |
with: | |
context: redis-server | |
push: ${{ github.event_name != 'pull_request' }} | |
file: redis-server/Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
labels: ${{ steps.meta.outputs.labels }} | |
tags: ${{ steps.meta.outputs.tags }} | |
redis-images-ghcr: | |
name: Build and upload redis container images to ghcr.io | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Container build and push | |
id: build-and-push | |
uses: greenbone/actions/container-build-push-generic@v3 | |
with: | |
build-context: redis-server | |
build-docker-file: redis-server/Dockerfile | |
cosign-key: ${{ secrets.COSIGN_KEY_OPENSIGHT }} | |
cosign-key-password: ${{ secrets.COSIGN_KEY_PASSWORD_OPENSIGHT }} | |
# The tlog function does not currently support an ed25519 key. | |
cosign-tlog-upload: "false" | |
image-url: greenbone/redis-server | |
image-labels: | | |
org.opencontainers.image.vendor=Greenbone | |
org.opencontainers.image.documentation=https://greenbone.github.io/docs/ | |
org.opencontainers.image.base.name=debian:stable-slim | |
image-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}} | |
registry: ${{ vars.IMAGE_REGISTRY }} | |
registry-username: ${{ github.actor }} | |
registry-password: ${{ secrets.GITHUB_TOKEN }} |