Skip to content

Build and Push Docker Image #5

Build and Push Docker Image

Build and Push Docker Image #5

name: Build and Push Docker Image
on:
workflow_dispatch:
push:
branches:
- main
paths:
- Containerfile
jobs:
build:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Lowercase REPO
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
file: Containerfile
push: true
tags: ghcr.io/${{ env.REPO }}:latest