template/.forgejo/workflows/build-on-commit.yml
merith-tk 1b7b89ccc6
All checks were successful
Build Docker Image on Commit / build-and-publish (push) Successful in 5s
remove push on commit to save on OCI storage
2024-10-02 11:20:38 -07:00

26 lines
543 B
YAML

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 }}