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

Support WARs. #431

Closed
coollog opened this issue Jun 20, 2018 · 14 comments
Closed

Support WARs. #431

coollog opened this issue Jun 20, 2018 · 14 comments
Assignees
Milestone

Comments

@coollog
Copy link
Contributor

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 this to the 0.10.0 milestone Jul 14, 2018
@coollog coollog added question User inquiries discuss labels Jul 14, 2018
@bennettdong
Copy link

Is there a timeline for this?

@coollog
Copy link
Contributor Author

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
Copy link

YJFinBJ commented Jul 19, 2018

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

@chanseokoh
Copy link
Member

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
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
Copy link
Contributor Author

coollog commented Jul 19, 2018

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

@tofflos
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
Copy link
Member

@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
Copy link

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

@CyrilleH
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
Copy link
Contributor Author

coollog commented Aug 29, 2018

@CyrilleH Thanks for sharing this!

@chanseokoh
Copy link
Member

chanseokoh commented Sep 19, 2018

Task tracking:

Refactoring and cleanups:

@coollog
Copy link
Contributor Author

coollog commented Nov 9, 2018

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

@mvysny
Copy link

mvysny commented Mar 29, 2019

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

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

No branches or pull requests