From 4572d890b8e3a3199a3ce7872c521f56d812370c Mon Sep 17 00:00:00 2001 From: Mike Chernev Date: Wed, 6 Jul 2016 10:40:49 +0200 Subject: [PATCH] Inital commit --- .gitignore | 1 + README.md | 5 +++++ docker-compose.yml | 9 +++++++++ pom.xml | 21 +++++++++++++++++++++ run.sh | 1 + src/main/webapp/WEB-INF/web.xml | 7 +++++++ src/main/webapp/index.jsp | 5 +++++ 7 files changed, 49 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 pom.xml create mode 100755 run.sh create mode 100644 src/main/webapp/WEB-INF/web.xml create mode 100644 src/main/webapp/index.jsp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +target diff --git a/README.md b/README.md new file mode 100644 index 0000000..3a1bd39 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +## Dockerised Java application + +The code for the blog post [http://geekyplatypus.com/packaging-and-serving-your-java-application-with-docker/](http://geekyplatypus.com/packaging-and-serving-your-java-application-with-docker/) + +To start the application you need to have [Docker](https://www.docker.com/) installed and execute `./run.sh` in your shell. \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a6a4049 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '2' +services: + web: + image: tomcat + ports: + - "8080:8080" + volumes: + - ./target/DockerExample.war:/usr/local/tomcat/webapps/ROOT.war + - ./target/DockerExample:/usr/local/tomcat/webapps/ROOT diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ca0894f --- /dev/null +++ b/pom.xml @@ -0,0 +1,21 @@ + + 4.0.0 + com.mikechernev.docker.example + DockerExample + war + 1.0-SNAPSHOT + DockerExample Maven Webapp + http://maven.apache.org + + + junit + junit + 3.8.1 + test + + + + DockerExample + + diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..72224be --- /dev/null +++ b/run.sh @@ -0,0 +1 @@ +docker run --rm -it -v /Users/mchernev/projects/posts/java-docker/DockerExample:/project -w /project maven mvn package && docker-compose up diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..9f88c1f --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + + Archetype Created Web Application + diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000..c38169b --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,5 @@ + + +

Hello World!

+ +