Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support based on Jib #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

danielpetisme
Copy link

A proposal for #18

It simply works (i used the openjdk:8-jdk-alpine as default image).
My concerns with jib:

  • According to their FAQ the local build requires a weird docker pull to make the image available. We'll see the result on a CI environment. Plus, it requires to run the jibDockerBuild rather than the simple jib task.

  • The docker build is 100% programatically, we can't override with a classic Dockerfile (discussed here. I understand the discussion but it's not ops-friendly

I wait for your feedback before starting the documentation.

@chanseokoh
Copy link

According to their FAQ the local build requires a weird docker pull to make the image available.

I think you misunderstood this. What the above means is, if you want to pull down to your local Docker daemon the Image built and pushed to a remote registry, you would do mvn jib:build followed by docker pull.

Also, instead of the round-trip, you can directly push to your local Docker daemon by mvn jib:dockerBuild, skipping pushing the image to some remote registry.

@jponge
Copy link
Owner

jponge commented Aug 31, 2018

I finally took time to test 😉

I ran ./gradlew test and after 10 minutes I had to kill it. I suppose that the added test just doesn't complete. Am I missing anything @danielpetisme?

@danielpetisme
Copy link
Author

My bad.
The hanging comes from the process output reading and a "daemon-like" process.

When you try to destroy the process, if the the reading stream is still open will prevent the process stop.
It's a mess to handle properly (in another project, I start a thread capturing the process's output and handling the original process stop/kill).

I'll fix that.

@danielpetisme
Copy link
Author

@jponge I take the opportunity to add a travis file (to fix the "it works on my machine" effect 😄 )

@@ -23,6 +23,11 @@ plugins {

repositories {
jcenter()
repositories {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really needed?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nevermind, you do need it.

Going into src/test/gradle/vertx-web-sample running gradle tasks fails because of that.

Copy link
Author

@danielpetisme danielpetisme Sep 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The com.google.cloud.tools:com.google.cloud.tools.jib.gradle.plugin seems only present in mavenCentral and not jcenter.

The Gradle plugin portal is a mirror to jcenter and Maven Central thats why it works wit the this snippet.

The options I can see:

  • Ask Google to publish the jib-gradle-plugin to jcenter (the jib maven plugin is already published). Do you know anyone able to do that?
  • Wait for the official publication, that will freeze this PR for a while
  • Update the project build files to include mavenCentral() (cleaner than pointing the plugin portal)
repositories {
  jcenter()
  mavenCentral()
  mavenLocal()
}

We should also update the documentation to explicit the need of Maven Central as a replacement/complement of JCenter.

WDYT?

@jponge
Copy link
Owner

jponge commented Sep 12, 2018 via email

@danielpetisme
Copy link
Author

For the jib-gradle dependency it seems jcenter is not fallbacking to L'avenir Central... 😢
Manipulating the repositories via the plugin looks more like a hack but I don't have a better plan (except completing the documentation).
I'll propose an update soon

@danielpetisme
Copy link
Author

danielpetisme commented Sep 18, 2018

@jponge I tried to move on this one.
I was wrong regarding mavenCentral()
According to mvnrepository the jib-gradle-plugin only exists in Gradle Plugins repo.

I raised an issue to ask for the publication of the plugin as a dependency on the common repos:
GoogleContainerTools/jib#1004

The src/test/gradle/vertx-web-sample has a stange behavior, it substitute the vertx-gradle-plugin dependency by the vertx-gradle-plugin project and tries to resolve its dependencies with the vertx-web-sample repositories definition (in that case jcenter() only).
I try to manipulate the project repositories programatically via vertx-gradle-plugin. But based on the structure defined above, Gradle first try to resolve the artifacts coming :classpath (ie. vertx-gradle-plugin) before applying the plugin and since it resolves with the vertx-web-sample repos definition (ie. jcenter) it fails to find jib dependency. Looks like a 🐔 || 🥚 issue.

I'm not sure this issue reflects a real-world situation. WDYT? For the plugin consistency, the issue can be fixed by adding gradlePluginPortal() in the repos definition of vertx-web-sample.

@jponge
Copy link
Owner

jponge commented Oct 6, 2018

Seems like we need to wait for GoogleContainerTools/jib#1004 right?

@danielpetisme
Copy link
Author

Not sure, I understand that the core of jib will be published as a common lib aimed to be integrated in client code. The gralde plugin will use this core lib but not sure the plugin itself will be published on classic repos.

Don't had time to dig it deeper and to be frank I don't know how to fix that in an elegant manner.

Maybe you can tag this PR as "on-hold".

val tag = if (project.version != Project.DEFAULT_VERSION) project.version else "latest"
jibExtension.apply {
from { imageConfiguration ->
imageConfiguration.image = "openjdk:8-jdk-alpine"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
imageConfiguration.image = "openjdk:8-jdk-alpine"
imageConfiguration.image = "openjdk:8-jre-alpine"

I think 'jre' is what we need

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants