Skip to content

Docker Build and Push (Bugzilla Lyo archives) #17

Docker Build and Push (Bugzilla Lyo archives)

Docker Build and Push (Bugzilla Lyo archives) #17

Workflow file for this run

name: "Docker Build and Push (Bugzilla Lyo archives)"
on:
push:
branches: [main, master]
paths:
- 'source/**'
- '.github/workflows/docker.yml'
release:
types: [published]
schedule:
# Weekly rebuild every Thursday at 5:00 AM UTC to get latest base image updates
- cron: '0 5 * * 4'
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Check build trigger
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
echo "🔄 This is a scheduled weekly rebuild to update base images"
elif [ "${{ github.event_name }}" = "release" ]; then
echo "🚀 This is a release build"
else
echo "📦 This is a regular build triggered by push"
fi
- name: Log in to Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# For pushes to master/main branch or scheduled builds, tag as "latest"
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || github.event_name == 'schedule' }}
# For releases, create semantic version tags
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.title=Eclipse Lyo Bugzilla archives
org.opencontainers.image.description=A demonstration OSLC CM server Eclipse Bugzilla Lyo archives
org.opencontainers.image.source="https://github.com/OSLC/adaptor-bugzilla-eclipse-archive"
org.opencontainers.image.licenses="EPL-2.0"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./source/BugzillaLyoArchives
file: ./source/BugzillaLyoArchives/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
# For scheduled builds, don't use cache to ensure fresh base images
no-cache: ${{ github.event_name == 'schedule' }}
pull: true
- name: Output image details
run: |
echo "Image has been pushed to:"
echo "${{ steps.meta.outputs.tags }}" | while read -r tag; do
echo " - $tag"
done