GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — chore(hermetic-build): use secure base image hosted in docker.com by diegomarquezp · Pull Request #3324 · googleapis/sdk-platform-java
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Conversation
|
|
|
||
| # install gapic-generator-java in a separate layer so we don't overload the image | ||
| # with the transferred source code and jars | ||
| FROM gcr.io/cloud-devrel-public-resources/java21@sha256:2ceff5eeea72260258df56d42e44ed413e52ee421c1b77393c5f2c9c4d7c41da AS ggj-build |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Where is gcr.io/cloud-devrel-public-resources/java21 coming from? Basically I'm trying to understand what is the base image for it eventually.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed it's based on eclipse-temurin-21
https://github.com/googleapis/testing-infra-docker/blob/main/java/java21/Dockerfile#L15
https://github.com/googleapis/testing-infra-docker/blob/main/java/cloudbuild.yaml#L163
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
| WORKDIR /home | ||
|
|
||
| # Install compatibility layer to run glibc-based programs (such as the | ||
| # grpc plugin). |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I guess protoc/gapic plugins as well?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
protoc can run without the compatibility layer. The java runtime is enabled via apk add, so the necessary shared objects (if any) will be brought by the package manager.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
At least only the grpc plugin gave me trouble due to missing shared objects.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| # downloadable distribution of the grpc plugin that is Alpine (musl) compatible. | ||
| # This is one of the recommended approaches to ensure glibc-compatibility | ||
| # as per https://wiki.alpinelinux.org/wiki/Running_glibc_programs | ||
| RUN git clone https://gitlab.com/manoel-linux1/GlibMus-HQ.git |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Where were these installed before? In one of the base images?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yes, most images come with binaries that were compiled with glibc. However Alpine is made with BusyBox + "musl libc", which cannot run certain linux binaries that were compiled with glibc (i.e. missing shared objects).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| RUN python -m pip install --require-hashes -r src/library_generation/requirements.txt | ||
| RUN python -m pip install src/library_generation | ||
|
|
||
| # Install nvm with node and npm |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why Node is not needed anymore? I thought we still need it for running owlbot cli?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's because Alpine can install nodejs + npm via apk
sdk-platform-java/.cloudbuild/library_generation/library_generation.Dockerfile
Lines 65 to 66 in 10b176b
| # install OS tools | |
| RUN apk update && apk add unzip curl rsync maven jq bash nodejs npm git |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| RUN mvn install -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip | ||
| RUN cp "/root/.m2/repository/com/google/api/gapic-generator-java/${DOCKER_GAPIC_GENERATOR_VERSION}/gapic-generator-java-${DOCKER_GAPIC_GENERATOR_VERSION}.jar" \ | ||
| RUN --mount=type=cache,target=/root/.m2 mvn dependency:go-offline -B -ntp -DskipTests -Dclirr.skip -Dcheckstyle.skip |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Why do we need mvn dependency?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It doesn't have any direct effect on the image but just to download the dependencies in a separate step. This is because we can leverage caching to prevent downloading the external dependencies every time we build the image.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How much time it would save by caching the external dependencies? In general, I think it's OK to always download it because we don't build image often. Caching is nice but sometimes we may run into issues where new dependencies are not downloaded.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
We removed this just to have a consistent behavior in local and prod (thanks @blakeli0)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| RUN apt-get update && apt-get install -y \ | ||
| unzip openjdk-17-jdk rsync maven jq \ | ||
| && apt-get clean | ||
| RUN apk update && apk add unzip curl rsync maven jq bash nodejs npm git |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Do we need maven in the final image?
As for java formatter, we've changed to download the jar so Java runtime is suffice.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This is because there is no candidate in APK to download the runtime directly (apk list jdk). I'll double check this.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Oh, well, apk list doesn't support partial string matches. I found openjdk11 by searching that exact string. Thanks for checking on this.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.