Add GitHub Actions workflow to build & push Docker image

This commit is contained in:
aditya.chandel
2025-03-11 18:27:01 -06:00
parent e049b8ab02
commit e84273d9d3
@@ -0,0 +1,31 @@
name: Build and Push to GitHub Container Registry
on:
push:
branches:
- main
release:
types: [published]
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 GitHub Container Registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Build Docker Image
run: |
docker build -t ghcr.io/${{ github.actor }}/booklore-app:latest .
- name: Push Docker Image to GHCR
run: |
docker push ghcr.io/${{ github.actor }}/booklore-app:latest