2024-10-02 19:20:38 +01:00
|
|
|
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 }}
|