template/.forgejo/workflows/build-on-commit.yml

27 lines
543 B
YAML
Raw Normal View History

name: Build Docker Image on Commit
on:
push:
branches:
- main
tags:
- '!' # Exclude tags
jobs:
build-and-publish:
runs-on: docker-builder
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build and push Docker image
run: |
REPO=git.merith.xyz/${{ github.repository }}
# Build Docker image
docker build -t $REPO:${{ github.sha }} .
# Remove the local image to save storage
docker rmi $REPO:${{ github.sha }}