Skip to content

falixchong/java-helloworld

 
 

Repository files navigation

Java Hello World Sample

Running the application using the command-line

This project can be built with Apache Maven. The project uses [Liberty Maven Plug-in][] to automatically download and install Liberty from the Liberty repository. Liberty Maven Plug-in is also used to create, configure, and run the application on the Liberty server.

Use the following steps to run the application locally:

  1. Execute full Maven build to create the target/JavaHelloWorldApp.war file:

    $ mvn clean install
  2. Download and install Liberty, then use it to run the built application from step 1:

    $ mvn liberty:run-server

    Once the server is running, the application will be available under http://localhost:9080/JavaHelloWorldApp.

Use the following command to run the built application in Bluemix: bash $ cf push <appname> -p target/JavaHelloWorldApp.war

Adding JavaHelloWorldApp.war into docker

docker pull websphere-liberty
docker run -d -p 80:9080 --name=app -v $PWD/target/JavaHelloWorldApp.war:/config/dropins/app.war websphere-liberty

Dockerfile

FROM websphere-liberty:latest
USER root
COPY --chown=1001:0 ./target/JavaHelloWorldApp.war /config/dropins/app.war
EXPOSE 9080
USER 1001

Build Dockerfile

docker build -t app .

Run docker image

docker run -d -p 80:9080 --name=app app

About

Sample Java application for Bluemix.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 36.8%
  • CSS 26.0%
  • Java 18.2%
  • HTML 15.9%
  • Dockerfile 3.1%