All checks were successful
Build and Push Docker Image / build-and-push (push) Successful in 4m9s
59 lines
1.7 KiB
YAML
59 lines
1.7 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths-ignore:
|
|
- README.md
|
|
- CHANGELOG.md
|
|
- LICENSE.md
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
schedule:
|
|
- cron: '@weekly'
|
|
|
|
env:
|
|
DOCKERFILE: ./Dockerfile
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ secrets.REGISTRY_URL }}
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ secrets.REGISTRY_URL }}/${{ github.repository }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=sha,prefix={{branch}}-
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=schedule,pattern={{date 'YYYYMMDD'}}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ${{ env.DOCKERFILE }}
|
|
platforms: linux/amd64
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ github.repository }}:buildcache
|
|
cache-to: type=registry,ref=${{ secrets.REGISTRY_URL }}/${{ github.repository }}:buildcache,mode=max
|