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

Support WARs. #431

Closed
coollog opened this Issue Jun 20, 2018 · 13 comments

Comments

Projects
None yet
10 participants
@coollog
Copy link
Member

coollog commented Jun 20, 2018

Thumbs up if you would like Jib to be able to containerize applications normally packaged as WARs.

@coollog coollog added the P2 label Jun 27, 2018

@coollog coollog added P0 and removed P2 labels Jul 14, 2018

@coollog coollog added this to the 0.10.0 milestone Jul 14, 2018

@xiangfeid

This comment has been minimized.

Copy link

xiangfeid commented Jul 17, 2018

Is there a timeline for this?

@coollog

This comment has been minimized.

Copy link
Member

coollog commented Jul 18, 2018

@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

@YJFinBJ

This comment has been minimized.

Copy link

YJFinBJ commented Jul 19, 2018

I have issue in "comand and tomcat war support #646"

@chanseokoh

This comment has been minimized.

Copy link
Member

chanseokoh commented Jul 19, 2018

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>
  1. $ mvn package
  2. $ 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
    
  3. $ docker build -t my-app-on-jetty target/
  4. $ docker run -p 8080:8080 -t my-app-on-jetty

The 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.

@briandealwis

This comment has been minimized.

Copy link
Member

briandealwis commented Jul 19, 2018

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.

@coollog

This comment has been minimized.

Copy link
Member

coollog commented Jul 19, 2018

Yep! Should be fairly simple to write an adapter for this war format once #516 is merged.

@tofflos

This comment has been minimized.

Copy link

tofflos commented Aug 3, 2018

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
@loosebazooka

This comment has been minimized.

Copy link
Member

loosebazooka commented Aug 3, 2018

@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.

@joelhandwell

This comment has been minimized.

Copy link

joelhandwell commented Aug 17, 2018

gretty is one of widespread gradle plugins for war app development and jib integration would be great.

@CyrilleH

This comment has been minimized.

Copy link
Contributor

CyrilleH commented Aug 20, 2018

Hello,

I added some code to support "exploded" WAR projects with the gradle plugin (in my forked repository).

Here you will find an example of use.

Maybe it may help...

@coollog

This comment has been minimized.

Copy link
Member

coollog commented Aug 29, 2018

@CyrilleH Thanks for sharing this!

@chanseokoh

This comment has been minimized.

Copy link
Member

chanseokoh commented Sep 19, 2018

Task tracking:

  • propagate WorkingDir (issue: #595 (comment) / PR #902)
  • propagate ExposedPorts (issue: #595 (comment))
  • propagate Cmd and Entrypoint (issue: #595 (comment), #924 / PR #1071)
  • add ZipUtil for unzipping WAR (PR: #906, #908)
  • support for exploded WAR layer configuration and distroless Jetty default entry (PR #917)
  • refactor 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)
  • fine-grained multiple layers instead of a single exploded WAR layer (PR #923)
  • Gradle WAR support (PR #923)
  • Maven WAR support (PR #1068)
    • Explode the final WAR instead of working on the exploded WAR directory (Issue #1091)
  • infer suitable appRoot for base popular images (Jetty / Tomcat / ? ...)
  • update docs (including container.appRoot) (PR #1147)
  • add a WAR example (PR #??? as a working sample / PR #1147 as a doc)
  • add integration tests (PR #1094 #1097 #1100 #1106)

Refactoring and cleanups:

  • #1090: setting the default base image and the app root
  • #1089: code reuse for WAR layer configuration between Maven and Gradle
  • #1088: cleanup
@coollog

This comment has been minimized.

Copy link
Member

coollog commented Nov 9, 2018

Hi everyone, version 0.10.0 has been released with support for WARs!

@TadCordle TadCordle closed this Nov 9, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment