From 41542e78f39dc5880412c5cad4744e077c054544 Mon Sep 17 00:00:00 2001 From: Eric Meisel Date: Sat, 25 Feb 2023 10:14:22 -0600 Subject: [PATCH] Publish jvm docker image --- .github/workflows/publish.yml | 7 +++++++ project/DockerImagePlugin.scala | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d4ca0caa..6523c461 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -131,6 +131,13 @@ jobs: run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin - name: Push to registry run: docker push ghcr.io/etspaceman/kinesis-mock:${{ github.event.release.tag_name }} + - name: Build jar docker image + run: sbt packageAndBuildDockerImage + env: + KINESIS_MOCK_DOCKERFILE: Dockerfile.Simple + KINESIS_MOCK_DOCKER_IMAGE_NAME: kinesis-mock-jvm + - name: Push jar image to registry + run: docker push ghcr.io/etspaceman/kinesis-mock-jvm:${{ github.event.release.tag_name }} - name: Upload JAR To Release id: upload-release-asset uses: actions/upload-release-asset@v1 diff --git a/project/DockerImagePlugin.scala b/project/DockerImagePlugin.scala index a4e2008d..758824e8 100644 --- a/project/DockerImagePlugin.scala +++ b/project/DockerImagePlugin.scala @@ -12,7 +12,7 @@ object DockerImagePlugin extends AutoPlugin { import autoImport._ val dockerTagTask: Def.Initialize[Task[String]] = Def.task { - s"${dockerRepository.value}/${dockerNamespace.value}/${name.value}:${imageTag.value}" + s"${dockerRepository.value}/${dockerNamespace.value}/${imageName.value}:${imageTag.value}" } val buildDockerImageTask: Def.Initialize[Task[Unit]] = Def.task { @@ -51,6 +51,8 @@ object DockerImagePlugin extends AutoPlugin { packageAndBuildDockerImage := packageAndBuildDockerImageTask.value, pushDockerImage := pushDockerImageTask.value, imageTag := (ThisBuild / version).value, + imageName := sys.env + .getOrElse("KINESIS_MOCK_DOCKER_IMAGE_NAME", name.value), dockerRepository := "ghcr.io", dockerNamespace := "etspaceman", jarLocation := "docker/image/lib/", @@ -65,6 +67,8 @@ object DockerImagePlugin extends AutoPlugin { object DockerImagePluginKeys { val imageTag = settingKey[String]("Tag for the image, e.g. latest") + val imageName = + settingKey[String]("Name for the docker image, e.g. kinesis-mock") val dockerRepository = settingKey[String]( "Repository for the docker images, e.g ghcr.io" )