Files
email-classifier/.github/workflows/build-publish.yaml
Daniel Henry 6f1ee81d27
Some checks failed
Build and Publish Docker Image / build-and-push (push) Failing after 4m51s
Add github actions
Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
2026-01-28 18:52:34 -06:00

38 lines
1.3 KiB
YAML

name: Build and Publish Docker Image
on:
push:
branches:
- main # Trigger on pushes to main
jobs:
build-and-push:
runs-on: ubuntu-latest # Ensure your Gitea runner has this label
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Login to your registry (Docker Hub, Gitea Package Registry, or Harbor)
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }} # Remove if using Docker Hub
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
push: true
# Tags the image as 'latest' and also uses the git SHA for versioning
tags: |
${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_USERNAME }}/email-classifier:latest
${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_USERNAME }}/email-classifier:${{ gitea.sha }}
# Caching speeds up builds by reusing layers (crucial for 'uv' installs)
cache-from: type=gha
cache-to: type=gha,mode=max