Add github actions
Some checks failed
Build and Publish Docker Image / build-and-push (push) Failing after 4m51s
Some checks failed
Build and Publish Docker Image / build-and-push (push) Failing after 4m51s
Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
38
.github/workflows/build-publish.yaml
vendored
Normal file
38
.github/workflows/build-publish.yaml
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
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
|
||||
Reference in New Issue
Block a user