Add GitHub Actions workflow to build & push Docker image
This commit is contained in:
@@ -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
|
||||||
Reference in New Issue
Block a user