template
This commit is contained in:
commit
8af3f92fec
3 changed files with 65 additions and 0 deletions
31
.forgejo/workflows/build-on-commit.yml
Normal file
31
.forgejo/workflows/build-on-commit.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
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 .
|
33
.forgejo/workflows/build-on-tag.yml
Normal file
33
.forgejo/workflows/build-on-tag.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
name: Build and Publish Docker Image on Tag
|
||||
|
||||
on:
|
||||
push:
|
||||
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 }}
|
||||
TAG=${{ github.ref_name }} # Get the tag name from the context
|
||||
# Build and push multi-platform Docker images
|
||||
docker build -t $REPO:$TAG --push .
|
||||
# Tag and push latest
|
||||
docker tag $REPO:$TAG $REPO:latest
|
||||
docker push $REPO:latest
|
1
Dockerfile
Normal file
1
Dockerfile
Normal file
|
@ -0,0 +1 @@
|
|||
FROM alpine:3.12
|
Loading…
Reference in a new issue