Skip to content

Commit

Permalink
Publish jvm docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
etspaceman committed Feb 25, 2023
1 parent 796b7ab commit 41542e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion project/DockerImagePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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/",
Expand All @@ -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"
)
Expand Down

0 comments on commit 41542e7

Please sign in to comment.