Comments (2)
Okay, this seems to change in behavior from OpenShift 3 to OpenShift 4 as specified in this OpenShift blogpost
With OpenShift 4 we undertook a fundamental redesign of how images are built on the platform. Instead of relying on a daemon on the host to manage containers, image creation, and image pushing, we are leveraging Buildah running inside our build pods. This aligns with the general OpenShift 4 theme of making everything “just another pod.”
The image cache is no longer shared. When using the host’s docker daemon, images and layers that had been pulled to the host previously could be reused by a subsequent build on that same host. Since builds no longer have access to the host, each build must pull any layers it requires each time the build is run. This helps improve the security posture of builds by providing an additional level of isolation, however it will also increase the time required to execute a build. We will be looking to reintroduce a shared image cache in the future.
When building the project against OpenShift 3.11.0 (minishift 1.34.3), I'm able to see docker cache getting used :
jkube-spring-boot3-openshift-docker-image-push : $ gradle ocBuild
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.6.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
> Task :ocBuild
oc: Running generator spring-boot
oc: spring-boot: Using Docker image quay.io/jkube/jkube-java:0.0.19 as base / builder
oc: Spring Boot layered jar detected
oc: Using OpenShift build with strategy Docker
oc: [docker.io/testuser/jkube-spring-boot3-openshift-docker-image-push:0.0.1] "spring-boot": Created docker source tar /home/rokumar/work/repos/jkube-testing/jkube-spring-boot3-openshift-docker-image-push/build/docker/docker.io/testuser/jkube-spring-boot3-openshift-docker-image-push/0.0.1/tmp/docker-build.tar
oc: Creating BuildServiceConfig jkube-spring-boot3-openshift-docker-image-push-s2i for Docker build
oc: Starting Build jkube-spring-boot3-openshift-docker-image-push-s2i
oc: Waiting for build jkube-spring-boot3-openshift-docker-image-push-s2i-1 to complete...
oc: Step 1/11 : FROM quay.io/jkube/jkube-java:0.0.19
oc: ---> d03f69fe626d
oc: Step 2/11 : ENV JAVA_MAIN_CLASS org.springframework.boot.loader.JarLauncher JAVA_APP_DIR /deployments
oc: ---> Using cache
oc: ---> 534191c61048
oc: Step 3/11 : LABEL org.label-schema.description "" org.label-schema.version 0.0.1 org.label-schema.schema-version 1.0 org.label-schema.build-date 2023-10-06 org.label-schema.name jkube-spring-boot3-openshift-docker-image-push org.label-schema.vcs-ref 706fa97b06efd6ac6c048b0ade461b764eb91a66 org.label-schema.vcs-url [email protected]:rohankanojia-forks/jkube-testing.git
oc: ---> Running in 9d9037b9cad2
oc: ---> dee416cb53e4
oc: Removing intermediate container 9d9037b9cad2
oc: Step 4/11 : EXPOSE 8080 8778 9779
oc: ---> Running in 4a6c9335db0c
oc: ---> 4d01dcebed03CUTING [13s]
oc: Removing intermediate container 4a6c9335db0c
oc: Step 5/11 : COPY /dependencies/deployments /deployments/
oc: ---> 1e48316c126aCUTING [13s]
oc: Removing intermediate container 4106c273dae8
oc: Step 6/11 : COPY /spring-boot-loader/deployments /deployments/
oc: ---> b019b1dc6a80CUTING [13s]
oc: Removing intermediate container ff1b7eb6a4a0
oc: Step 7/11 : COPY /application/deployments /deployments/
oc: ---> 30a2e03788bbCUTING [14s]
oc: Removing intermediate container 1c3e5fbdf135
oc: Step 8/11 : WORKDIR /deployments
oc: ---> 3179904561f2CUTING [14s]
oc: Removing intermediate container 04b1f34e3700
oc: Step 9/11 : ENTRYPOINT java org.springframework.boot.loader.JarLauncher
oc: ---> Running in d200ef9cae87
oc: ---> 163e7be19769CUTING [14s]
oc: Removing intermediate container d200ef9cae87
oc: Step 10/11 : ENV "OPENSHIFT_BUILD_NAME" "jkube-spring-boot3-openshift-docker-image-push-s2i-1" "OPENSHIFT_BUILD_NAMESPACE" "myproject"
oc: ---> Running in 0354276924d1]
oc: ---> 7a42ef023f3eCUTING [14s]
oc: Removing intermediate container 0354276924d1
oc: Step 11/11 : LABEL "io.openshift.build.name" "jkube-spring-boot3-openshift-docker-image-push-s2i-1" "io.openshift.build.namespace" "myproject"
oc: ---> Running in a2215e45ec9f]
oc: ---> b39d8814f1b1
oc: Removing intermediate container a2215e45ec9f
oc: Successfully built b39d8814f1b1
oc: Pushing image docker.io/testuser/jkube-spring-boot3-openshift-docker-image-push:0.0.1 ...
oc: Pushed 2/5 layers, 43% complete
oc: Pushed 3/5 layers, 97% complete
oc: Pushed 4/5 layers, 100% complete
oc: Pushed 5/5 layers, 100% complete
oc: Push successful
oc: Build jkube-spring-boot3-openshift-docker-image-push-s2i-1 in status Complete
BUILD SUCCESSFUL in 36s
1 actionable task: 1 executed
jkube-spring-boot3-openshift-docker-image-push : $ gradle ocBuild
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.6.1/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build
> Task :ocBuild
oc: Running generator spring-boot
oc: spring-boot: Using Docker image quay.io/jkube/jkube-java:0.0.19 as base / builder
oc: Spring Boot layered jar detected
oc: Using OpenShift build with strategy Docker
oc: [docker.io/testuser/jkube-spring-boot3-openshift-docker-image-push:0.0.1] "spring-boot": Created docker source tar /home/rokumar/work/repos/jkube-testing/jkube-spring-boot3-openshift-docker-image-push/build/docker/docker.io/testuser/jkube-spring-boot3-openshift-docker-image-push/0.0.1/tmp/docker-build.tar
oc: Updating BuildServiceConfig jkube-spring-boot3-openshift-docker-image-push-s2i for Docker strategy:ocBuild
oc: Starting Build jkube-spring-boot3-openshift-docker-image-push-s2i
oc: Waiting for build jkube-spring-boot3-openshift-docker-image-push-s2i-2 to complete...
oc: Step 1/11 : FROM quay.io/jkube/jkube-java:0.0.19
oc: ---> d03f69fe626d
oc: Step 2/11 : ENV JAVA_MAIN_CLASS org.springframework.boot.loader.JarLauncher JAVA_APP_DIR /deployments
oc: ---> Using cache
oc: ---> 534191c61048
oc: Step 3/11 : LABEL org.label-schema.description "" org.label-schema.version 0.0.1 org.label-schema.schema-version 1.0 org.label-schema.build-date 2023-10-06 org.label-schema.name jkube-spring-boot3-openshift-docker-image-push org.label-schema.vcs-ref 706fa97b06efd6ac6c048b0ade461b764eb91a66 org.label-schema.vcs-url [email protected]:rohankanojia-forks/jkube-testing.git
oc: ---> Using cache
oc: ---> dee416cb53e4
oc: Step 4/11 : EXPOSE 8080 8778 9779
oc: ---> Using cache
oc: ---> 4d01dcebed03
oc: Step 5/11 : COPY /dependencies/deployments /deployments/
oc: ---> Using cache
oc: ---> 1e48316c126a
oc: Step 6/11 : COPY /spring-boot-loader/deployments /deployments/
oc: ---> Using cache
oc: ---> b019b1dc6a80
oc: Step 7/11 : COPY /application/deployments /deployments/
oc: ---> Using cache
oc: ---> 30a2e03788bb
oc: Step 8/11 : WORKDIR /deployments
oc: ---> Using cache
oc: ---> 3179904561f2
oc: Step 9/11 : ENTRYPOINT java org.springframework.boot.loader.JarLauncher
oc: ---> Using cache
oc: ---> 163e7be19769
oc: Step 10/11 : ENV "OPENSHIFT_BUILD_NAME" "jkube-spring-boot3-openshift-docker-image-push-s2i-2" "OPENSHIFT_BUILD_NAMESPACE" "myproject"
oc: ---> Running in 84381f68f2d7
oc: ---> 4e11ce6a7b7a
oc: Removing intermediate container 84381f68f2d7
oc: Step 11/11 : LABEL "io.openshift.build.name" "jkube-spring-boot3-openshift-docker-image-push-s2i-2" "io.openshift.build.namespace" "myproject"
oc: ---> Running in 464510916c4b
oc: ---> 342e40203bff
oc: Removing intermediate container 464510916c4b
oc: Successfully built 342e40203bff
oc: Pushing image docker.io/testuser/jkube-spring-boot3-openshift-docker-image-push:0.0.1 ...
oc: Push successful
oc: Build jkube-spring-boot3-openshift-docker-image-push-s2i-2 in status Complete
BUILD SUCCESSFUL in 26s
1 actionable task: 1 executed
jkube-spring-boot3-openshift-docker-image-push : $
I think we can provide individual layers in container image as extracted by spring boot, but it won't provide caching benefits on OpenShift 4 due to no shared docker cache.
from jkube.
I've created #2413 that should not flatten Spring Boot image layers when in docker
build strategy. However, while testing it I'm not able to see any kind of caching by docker host inside OpenShift.
We're correctly passing noCache: false
inside the BuildConfig's build strategy. There is no difference in Dockerfile generated in consecutive builds either. Not sure if this is something specific to OpenShift.
from jkube.
Related Issues (20)
- Gradle: Ensure Gradle configuration Cache HOT 1
- AssemblyConfigurationTest : Replace AssertJ's deprecated `asList()` DSL method with `asInstanceOf(InstanceOfAssertFactories.list(type.class))` HOT 1
- JibServiceTest : Statement lambda can be replaced with expression lambda HOT 1
- PortForwardService : Remove duplicated method `getNewestPod` HOT 5
- JibBuildServiceBuildTest.build_shouldLogBuiltTarImage is failing on windows HOT 2
- ResourceMojoTest is failing on windows HOT 5
- JibImageBuildServiceBuildTest is failing on windows HOT 5
- IngressConfigTest : Replace AssertJ's deprecated `asList()` DSL method with `asInstanceOf(InstanceOfAssertFactories.list(type.class))` HOT 1
- OpenShiftHelperTest : Replace AssertJ's deprecated `asList()` DSL method with `asInstanceOf(InstanceOfAssertFactories.list(type.class))` HOT 1
- HelidonGeneratorTest : Replace AssertJ's deprecated `asList()` DSL method with `asInstanceOf(InstanceOfAssertFactories.list(type.class))` HOT 4
- [OpenShift Maven Plugin] : Move duplicated methods in Mojos to a common interface HOT 1
- JavaExecGenerator does not honor %t setting HOT 4
- How can I use the org.eclipse.jkube.kubernetes plugin in Gradle Kotlin DSL? HOT 6
- DockerImageWatcherRestartContainerTest : Replace AssertJ's deprecated `asList()` DSL method with `asInstanceOf(InstanceOfAssertFactories.list(type.class))` HOT 1
- WildflyJARHealthCheckEnricherTest : Replace AssertJ's deprecated `asList()` DSL method with `asInstanceOf(InstanceOfAssertFactories.list(type.class))` HOT 1
- SpringBootWatcherIntegrationTest is failing on windows HOT 1
- BuildService : Replace outdated method for joining strings with inbuilt `String.join` HOT 8
- OpenShiftResourceMojoTest is failing on Windows due to use of `\n` as line separator HOT 4
- Remove workaround from KubernetesMockServerUtil once issue is fixed in KubernetesMockServer
- Replace deprecated method from Updatable interface
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jkube.