Skip to content

docker-github

docker-github #2

Workflow file for this run

name: docker-github
on:
workflow_dispatch
jobs:
deploy_to_docker:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- kinesis
- kafka
include:
- suffix: ""
steps:
- uses: actions/checkout@v4
- uses: coursier/cache-action@v6
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'corretto'
- name: Get current version
id: ver
run: |
export PROJECT_VERSION=$(sbt "project core" version -Dsbt.log.noformat=true | perl -ne 'print "$1\n" if /info.*(\d+\.\d+\.\d+[^\r\n]*)/' | tail -n 1 | tr -d '\n')
echo "project_version=$PROJECT_VERSION" >> $GITHUB_OUTPUT
- name: Docker:stage
run: sbt "project ${{ matrix.platform }}" docker:stage
- name: Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: opensnowcat/opensnowcat-collector-${{ matrix.platform }}${{ matrix.suffix }}
tags: |
type=raw,value=${{ steps.ver.outputs.project_version }}
flavor: |
latest=false
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push image
uses: docker/build-push-action@v2
with:
context: ${{ matrix.platform }}/target/docker/stage
file: ${{ matrix.platform }}/target/docker/stage/Dockerfile
platforms: linux/amd64,linux/arm64/v8
tags: ${{ steps.meta.outputs.tags }}
push: true