Skip to content

Commit

Permalink
Update docker image build and publication. (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
dzarras authored Nov 22, 2023
1 parent 4bab7f6 commit 84f1b58
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/publish-to-container-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,10 @@ jobs:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=semver,pattern=v{{version}}
type=edge
- name: Debug
run: echo ${{ steps.meta.outputs }}
- name: Build and publish with Gradle Wrapper
uses: gradle/[email protected]
if: github.event_name != 'pull_request'
Expand All @@ -81,4 +79,4 @@ jobs:
bootBuildImage
--imageName=${{ fromJSON(steps.meta.outputs.json).tags[0] }}
--publishImage
--full-stacktrace
--full-stacktrace
18 changes: 11 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,22 @@ springBoot {
}

tasks.named<BootBuildImage>("bootBuildImage") {
imageName.set("${project.name}")
imageName.set("$group/${project.name}")
publish.set(false)
// get the BP_OCI_* from env, for https://github.com/paketo-buildpacks/image-labels
// get the BP_JVM_* from env, jlink optimisation
environment.set(System.getenv())
val env = environment.get()
docker {
publishRegistry {
url = System.getenv("REGISTRY_URL")
username = System.getenv("REGISTRY_USERNAME")
password = System.getenv("REGISTRY_PASSWORD")
env["REGISTRY_URL"]?.let { url = it }
env["REGISTRY_USERNAME"]?.let { username = it }
env["REGISTRY_PASSWORD"]?.let { password = it }
}
env["DOCKER_METADATA_OUTPUT_TAGS"]?.let { tagStr ->
tags = tagStr.split(delimiters = arrayOf("\n", " ")).onEach { println("Tag: $it") }
}
}
// get the BP_OCI_* from env, for https://github.com/paketo-buildpacks/image-labels
// get the BP_JVM_* from env, jlink optimisation
environment.set(System.getenv())
}

spotless {
Expand Down

0 comments on commit 84f1b58

Please sign in to comment.