Add GitHub Actions workflow to build Docker image

This commit is contained in:
Keyvan Ebrahimpour 2025-04-09 23:27:03 +00:00
parent 667e6e388e
commit 408942999f

27
.github/workflows/docker.yml vendored Normal file
View file

@ -0,0 +1,27 @@
name: Build and Push Docker Image
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker Image
run: |
IMAGE=ghcr.io/${{ github.repository }}
docker build -t $IMAGE:latest .
docker push $IMAGE:latest