Skip to content

Commit

Permalink
Make Docker action build base image weekly
Browse files Browse the repository at this point in the history
  • Loading branch information
vicnett committed Nov 4, 2024
1 parent 6a9e121 commit 1dceaf1
Showing 1 changed file with 47 additions and 7 deletions.
54 changes: 47 additions & 7 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,54 @@
name: Build Docker image
name: Build and push base Docker image

on:
push:
branches: [main]
schedule:
- cron: '0 17 * * FRI'

pull_request:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
build-and-push-image:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write
attestations: write
id-token: write

steps:
- uses: actions/checkout@v4
- run: docker build .
- name: Login to the Conainer Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
id: push
uses: docker/build-push-action@v6
with:
push: true
target: install
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true

0 comments on commit 1dceaf1

Please sign in to comment.