jib icon indicating copy to clipboard operation
jib copied to clipboard

Add missing simple documentation for how to use JIB on Google Cloud Build in README

Open vorburger opened this issue 3 years ago • 5 comments

Background: I'm looking into https://github.com/vorburger/www.fineract.dev/issues/11 and need to convert a Google Cloud Build YAML configuration which used to "just work" for an open source project which used to have a Dockerfile and was switched to JIB by a contributor.

In an ideal world, it would be neat if I could just Ctrl-F for "Google Cloud Build" on the JIB README and it would tell me what I need to do.

Would you accept to review and merge a Pull Request with some addendum to the doc for this?

vorburger avatar Jan 05 '22 01:01 vorburger

It seems like nowadaways this is as simple as shown e.g. in https://github.com/GoogleCloudPlatform/air-draw-demo/blob/master/cloudbuild.yaml? That seems wortwhile (even only very succintly) mentioning on the README.

vorburger avatar Jan 05 '22 01:01 vorburger

The non-availability of gcr.io/cloud-builders/javac:17 (nor :11, only :8) can be a "show stopper" for using JIB from Google Cloud Build for some projects.

vorburger avatar Jan 05 '22 02:01 vorburger

The non-availability of gcr.io/cloud-builders/javac:17 (nor :11, only :8) can be a "show stopper" for using JIB from Google Cloud Build for some projects.

This is wrong, as per this discussion, one CAN use other Java container images.

But a ./gradlew in gcr.io/distroless/java17-debian11:debug fails with:

Step #1: standard_init_linux.go:228: exec user process caused: no such file or directory

but using (e.g.) docker.io/library/eclipse-temurin:17 for https://hub.docker.com/_/eclipse-temurin/ from https://adoptium.net works, as do presumably a number of other JDK container images, such as azul/zulu-openjdk-alpine:17 (not tested).

Would a PR with something about this added to the README be welcome?

@jamesward FYI

vorburger avatar Jan 05 '22 04:01 vorburger

Oh, right. I forgot that the distroless images are based on busybox so you have to do something like:

  - id: 'test'
    name: 'gcr.io/distroless/java:8-debug'
    entrypoint: '/busybox/sh'
    args:
      - -c
      - |
        ln -s /busybox/sh /bin/sh
        ./gradlew --console=plain --no-daemon --gradle-user-home=/home/.gradle test

Or maybe:

- id: 'build-image'
    name: 'gcr.io/distroless/java:8-debug'
    entrypoint: '/busybox/sh'
    args:
      - -c
      - |
        ln -s /busybox/env /usr/bin/env
        /workspace/gradlew --console=plain --no-daemon --gradle-user-home=/home/.gradle bootBuildImage --imageName=gcr.io/$PROJECT_ID/$REPO_NAME:$COMMIT_SHA

A non-Jib example that might be helpful: https://github.com/jamesward/spring-kotlin-postgres/blob/c50c5cdff58970c2fb6249a020e2eb8136478ef3/cloudbuild.yaml

jamesward avatar Jan 05 '22 04:01 jamesward

@vorburger Please let us know or contribute the documentation update once you test out the suggested options. Thanks!

meltsufin avatar Jan 05 '22 15:01 meltsufin