Skip to content

Docker Build

Docker Build #923

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:
- 'v*'
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@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
with:
egress-policy: audit
- name: Checkout main repository
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- 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 Node.js
uses: actions/setup-node@v6
with:
node-version: '22' # or your required version
- name: Run npx auth secret
run: |
cp docs/templates/template.env .env.local
npx auth secret
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Login to GitHub Container Registry
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.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@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
with:
images: |
${{ env.REGISTRY }}/${{ env.ORG_BASE_NAME }}
- name: Build sw360 build container
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.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