Skip to content

Merge pull request #17 from Cybersecurity-and-Enterprise-Security/ref… #54

Merge pull request #17 from Cybersecurity-and-Enterprise-Security/ref…

Merge pull request #17 from Cybersecurity-and-Enterprise-Security/ref… #54

Workflow file for this run

name: Docker
on:
push:
branches: [ "main" ]
# Also run on semver tags to publish releases for them.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]
env:
# We use the GitHub Container Registry to publish our images.
REGISTRY: ghcr.io
# The name of the image includes the account and repository name (<account>/<repo>).
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
if: ${{ github.event_name != 'pull_request' }}
uses: docker/build-push-action@v6
with:
context: .
file: ./build/Dockerfile
platforms: linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Binaries
uses: docker/build-push-action@v6
with:
context: .
file: ./build/Dockerfile
platforms: linux/arm/v7,linux/arm/v6,linux/arm64,linux/amd64
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
target: binary
outputs: type=local,dest=./bin
- name: Upload Binaries Artifact
uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull_request' }}
with:
name: bin
path: bin/