Skip to content

ci: Add GitHub workflow for building and pushing base Docker image #1

ci: Add GitHub workflow for building and pushing base Docker image

ci: Add GitHub workflow for building and pushing base Docker image #1

Workflow file for this run

name: Build and Push Base Image
on:
push:
branches: [ main ]
paths:
- 'Dockerfile.base'
workflow_dispatch:
env:
REGISTRY: ghcr.io
BASE_IMAGE_NAME: ${{ github.repository }}-base
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile.base
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}