Skip to content

Commit

Permalink
Add docker images publishing (#19)
Browse files Browse the repository at this point in the history
* add docker build action

* publish on release

* add arm64 image

* remove arm64 build
  • Loading branch information
YaroShkvorets authored Jan 21, 2025
1 parent f792c1e commit 631c30b
Showing 1 changed file with 75 additions and 0 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build and Publish Docker images

on:
release:
types: [published]

env:
REGISTRY: ghcr.io
SINK_IMAGE_NAME: ${{ github.repository }}-sink
API_IMAGE_NAME: ${{ github.repository }}-api

jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for git describe

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Sink
id: meta-sink
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.SINK_IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Extract metadata (tags, labels) for API
id: meta-api
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.API_IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Sink image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
target: sink
push: true
tags: ${{ steps.meta-sink.outputs.tags }}
labels: ${{ steps.meta-sink.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push API image
uses: docker/build-push-action@v5
with:
context: .
file: docker/Dockerfile
target: api
push: true
tags: ${{ steps.meta-api.outputs.tags }}
labels: ${{ steps.meta-api.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 631c30b

Please sign in to comment.