31 lines
823 B
YAML
31 lines
823 B
YAML
name: Build and Publish 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: Test Docker Hello World
|
|
run: |
|
|
echo "Testing Docker connection..."
|
|
docker run hello-world
|
|
|
|
- name: Login to OCI registry
|
|
run: |
|
|
echo "${{ secrets.OCI_TOKEN }}" | docker login git.merith.xyz -u "${{ secrets.OCI_USER }}" --password-stdin
|
|
|
|
- name: Build and push Docker image
|
|
run: |
|
|
REPO=git.merith.xyz/${{ github.repository }}
|
|
# Build and push multi-platform Docker images
|
|
docker build -t $REPO:${{ github.sha }} --push .
|