Skip to content

Commit c393645

Browse files
authored
Adding Docker build and Push
Dockerhub + GHCR upload for testing. README to be uddated following testing.
1 parent 0181e75 commit c393645

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build and Publish Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # Triggers on tags like v1.0.0, v0.1.5
7+
8+
env:
9+
DOCKERHUB_USERNAME: 00jlich
10+
DOCKER_HUB_REPO: abs-kosync-bridge
11+
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
jobs:
17+
docker:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 1
24+
25+
- name: Extract metadata (tags, labels)
26+
id: meta
27+
uses: docker/metadata-action@v5
28+
with:
29+
images: |
30+
${{ env.DOCKERHUB_USERNAME }}/${{ env.DOCKER_HUB_REPO }}
31+
ghcr.io/${{ github.repository }}
32+
tags: |
33+
type=semver,pattern={{version}}
34+
type=semver,pattern={{major}}.{{minor}}
35+
type=raw,value=latest,enable=${{ !contains(github.ref, '-') }}
36+
37+
- name: Set up QEMU
38+
uses: docker/setup-qemu-action@v3
39+
40+
- name: Set up Docker Buildx
41+
uses: docker/setup-buildx-action@v3
42+
43+
# Login to Docker Hub
44+
- name: Login to Docker Hub
45+
if: github.event_name != 'pull_request'
46+
uses: docker/login-action@v3
47+
with:
48+
username: ${{ env.DOCKERHUB_USERNAME }}
49+
password: ${{ secrets.DOCKERHUB_TOKEN }}
50+
51+
# Login to GitHub Container Registry
52+
- name: Login to GitHub Container Registry
53+
if: github.event_name != 'pull_request'
54+
uses: docker/login-action@v3
55+
with:
56+
registry: ghcr.io
57+
username: ${{ github.actor }}
58+
password: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Build and push Docker image
61+
uses: docker/build-push-action@v5
62+
with:
63+
context: .
64+
platforms: linux/amd64,linux/arm64,linux/arm/v7
65+
push: ${{ github.event_name != 'pull_request' }}
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}
68+
cache-from: type=gha
69+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)