Thumbs up if you would like Jib to be able to containerize applications normally packaged as WARs.
Is there a timeline for this?
@xiangfeid We are actively working on this issue and welcome input for solutions from anyone in the community. We expect a solution to be provided by the 0.10.0 version milestone.
@chanseokoh will be able to guide the conversation and design
I have issue in "comand and tomcat war support #646"
For documentation after some preliminary research:
pom.xml of an example Maven WAR project:
<packaging>war</packaging>
<version>0.1.0-SNAPSHOT</version>
<groupId>com.example</groupId>
<artifactId>war-example</artifactId>
$ mvn package$ cat > target/Dockerfile <<EOF
FROM gcr.io/distroless/java/jetty:debug
# By convention, the exploded WAR directory is <artifact-id>-<version>.
COPY war-example-0.1.0-SNAPSHOT /jetty/webapps/ROOT
ENTRYPOINT ["java","-jar","/jetty/start.jar"]
CMD []
EOF
$ docker build -t my-app-on-jetty target/$ docker run -p 8080:8080 -t my-app-on-jettyThe app will be available at localhost:8080. I expect the Tomcat base image would not be too different from this flow.
There are other images like the official Jetty Docker image and the Google-maintained Jetty runtime image, but I think we'll stick to the distroless Jetty. I hope it enabled all the typical web app support like JSP and JSTL.
So we could put WEB-INF/classes in one layer, WEB-INF/lib in a second layer, and everything else in a third layer. Does that make sense?
_Updated:_ oh we should do the same -SNAPSHOT separation too.
Yep! Should be fairly simple to write an adapter for this war format once #516 is merged.
What if you have a thin WAR and need a complete application server? Currently I do this to get a complete MicroProfile stack:
FROM payara/micro
ARG WAR
COPY $WAR $DEPLOY_DIR
@tofflos, are you wondering about provided deps? We do not include provided deps so if MicroProfile is providing them for you that's fine.
In the case of the app server, you would still pull payara/micro. The one issue is determining $DEPLOY_DIR, we will have a provision for custom application locations, our default case will probably support distroless/jetty though.
gretty is one of widespread gradle plugins for war app development and jib integration would be great.
@CyrilleH Thanks for sharing this!
Task tracking:
WorkingDir (issue: https://github.com/GoogleContainerTools/jib/issues/595#issuecomment-417104491 / PR #902)ExposedPorts (issue: https://github.com/GoogleContainerTools/jib/issues/595#issuecomment-417128933)Cmd and Entrypoint (issue: https://github.com/GoogleContainerTools/jib/issues/595#issuecomment-418744421, #924 / PR #1071)ZipUtil for unzipping WAR (PR: #906, #908)JavaLayerConfiguration to allow configuring files in a flexible way (issue #1007 / PR #1010 / PR #1049 )container.appRoot for configuring the application root (issue #964 / PR #984)appRoot for base popular images (Jetty / Tomcat / ? ...)container.appRoot) (PR #1147)Refactoring and cleanups:
Hi everyone, version 0.10.0 has been released with support for WARs!
Hi @coollog thank you very much! Is this feature documented please, or is there an example project for this?
EDIT: pardon me, it's at https://github.com/GoogleContainerTools/jib/tree/master/jib-gradle-plugin#war-projects
Most helpful comment
Hi everyone, version
0.10.0has been released with support for WARs!