Skip to content

Docker Build

Docker Build #562

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: Checkout main repository
uses: actions/checkout@v4
- 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@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
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@v5
with:
images: |
${{ env.REGISTRY }}/${{ env.ORG_BASE_NAME }}
- name: Build sw360 build container
uses: docker/build-push-action@v6
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