Skip to content

Docker Build

Docker Build #596

Workflow file for this run

# Copyright (c) Helio Chissini de Castro, 2023. Part of the SW360 Frontend Project.
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
# License-Filename: LICENSE
name: Docker Build
on:
schedule:
- cron: '0 0 * * *' # Midnight
workflow_dispatch:
push:
tags:
- 'sw360-*'
paths-ignore:
- "**.md"
env:
REGISTRY: ghcr.io
permissions: write-all
jobs:
docker_push:
if: ${{ github.event.schedule }} == '0 0 * * *'
name: Build Docker Image
runs-on: ubuntu-24.04
permissions:
contents: read
packages: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout main repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set environment variables
run: |
echo "ORG_BASE_NAME=${GITHUB_REPOSITORY}" >> $GITHUB_ENV
echo "GIT_REVISION=$(git describe --abbrev=6 --always --tags --match=[0-9]*)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- name: Login to GitHub Container Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
#------------------------------------------------
# SW360 Frontend
- name: Extract components metadata (tags, labels) runtime image
id: meta_runtime
uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
with:
images: |
${{ env.REGISTRY }}/${{ env.ORG_BASE_NAME }}
- name: Build sw360 build container
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
context: .
push: true
load: false
tags: |
${{ steps.meta_runtime.outputs.tags }}
labels: ${{ steps.meta_runtime.outputs.labels }}
cache-from: type=gha,scope=runtime
cache-to: type=gha,scope=runtime,mode=max