Skip to content

enabled image build cache on gha (#5) #11

enabled image build cache on gha (#5)

enabled image build cache on gha (#5) #11

Workflow file for this run

name: Build and push to GHCR
on:
push:
branches: [main]
paths:
- Containerfile
- .github/workflows/**
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Set timestamp tag
id: vars
run: echo "timestamp=$(date -u +'%Y%m%d-%H%M%S')" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: .
file: Containerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.timestamp }}