jib icon indicating copy to clipboard operation
jib copied to clipboard

Publish jib-cli so it can be used from Java code

Open lion7 opened this issue 6 months ago • 1 comments

I'm trying to use jib to publish my frontend image as well, just as I did for my Java backend. Previously I used the Docker CLI for this, but I'd like to create all my images without the use of a daemon or elevated rights. If the jib CLI itself would also be published to Maven central, I can re-use it from my Gradle build script to build a non-java image like so:

plugins {
  id("org.siouan.frontend-jdk21") version "10.0.0"
}

frontend {
  nodeVersion.set("24.2.0")
  assembleScript.set("run build")
  checkScript.set("run lint")
}

task<JavaExec>("jib") {
  group = "jib"
  description = "Builds and pushes the container image to the container registry."
  mainClass.set("com.google.cloud.tools.jib.cli.JibCli")
  dependsOn("assembleFrontend")
  args("build", "--image-metadata-out=build/jib-image.json", "--target", "my-image:latest")
}

For completeness and for people coming here from Google, this is my accompanying jib.yaml:

apiVersion: jib/v1alpha1
kind: BuildFile
from:
  image: caddy
layers:
  entries:
    - name: "static"
      files:
        - src: "Caddyfile"
          dest: "/etc/caddy/Caddyfile"
        - src: "dist/"
          dest: "/srv"

lion7 avatar Jun 16 '25 09:06 lion7

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Jun 16 '25 09:06 google-cla[bot]