Giter VIP home page Giter VIP logo

jersey-docker-demo's People

Contributors

ysubach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jersey-docker-demo's Issues

Containerize with docker-compose

I'm trying to containerize a new Maven/Jersey app with docker-compose.

My docker-compose.yml:


version: '2'
services:

  maven:
    build: ./maven

And my maven/Dockerfile:

# fetch basic image
FROM maven:3.3.9-jdk-8-alpine

# application placed into /opt/app
RUN mkdir -p /opt/app
WORKDIR /opt/app/

# selectively add the POM file and
# install dependencies
COPY api/pom.xml /opt/app/
RUN mvn install

# rest of the project
COPY api/src /opt/app/src
RUN mvn package

# local application port
EXPOSE 8080

# execute it
CMD ["mvn", "exec:java"]

api/ directory is my source application directory (as another git submodule).

But, when app is starting up, "docker-compose up" docker-compose process the script and "hit an enter" after docker maven is running, terminating the process. See the log:

maven_1    | [INFO] Scanning for projects...
maven_1    | [INFO]                                                                         
maven_1    | [INFO] ------------------------------------------------------------------------
maven_1    | [INFO] Building jersey-docker-desafio 1.0-SNAPSHOT
maven_1    | [INFO] ------------------------------------------------------------------------
maven_1    | [INFO] 
maven_1    | [INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate @ jersey-docker-desafio >>>
maven_1    | [INFO] 
maven_1    | [INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate @ jersey-docker-desafio <<<
maven_1    | [INFO] 
maven_1    | [INFO] --- exec-maven-plugin:1.2.1:java (default-cli) @ jersey-docker-desafio ---
maven_1    | Jan 28, 2017 5:50:11 PM org.glassfish.grizzly.http.server.NetworkListener start
maven_1    | INFO: Started listener bound to [0.0.0.0:8080]
maven_1    | Jan 28, 2017 5:50:11 PM org.glassfish.grizzly.http.server.HttpServer start
maven_1    | INFO: [HttpServer] Started.
maven_1    | Jersey app started with WADL available at http://0.0.0.0:8080/desafio/application.wadl
maven_1    | Hit enter to stop it...
maven_1    | Jan 28, 2017 5:50:11 PM org.glassfish.grizzly.http.server.NetworkListener shutdownNow
maven_1    | INFO: Stopped listener bound to [0.0.0.0:8080]
maven_1    | [INFO] ------------------------------------------------------------------------
maven_1    | [INFO] BUILD SUCCESS
maven_1    | [INFO] ------------------------------------------------------------------------
maven_1    | [INFO] Total time: 3.594 s
maven_1    | [INFO] Finished at: 2017-01-28T17:50:11+00:00
maven_1    | [INFO] Final Memory: 10M/115M
maven_1    | [INFO] ------------------------------------------------------------------------

Pay attention to these log lines:

maven_1    | Jersey app started with WADL available at http://0.0.0.0:8080/desafio/application.wadl
maven_1    | Hit enter to stop it...
maven_1    | Jan 28, 2017 5:50:11 PM org.glassfish.grizzly.http.server.NetworkListener shutdownNow
maven_1    | INFO: Stopped listener bound to [0.0.0.0:8080]

Do you know how can I run the app without attaching the "input" from the terminal?
Something like an alternative to CMD in the Dockerfile ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.