Skip to content

Commit 2e8c7bf

Browse files
committed
update readme
1 parent 76fb4cb commit 2e8c7bf

File tree

1 file changed

+33
-24
lines changed

1 file changed

+33
-24
lines changed

README.md

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ Simple java project demos how to build a war file to be deployed on a Tomcat ser
66

77
The build script uses `mvn package` to produce a demo.war file and then bundles it with a Docker image that runs Tomcat. Usage:
88

9-
```sh
10-
bin/build
11-
```
9+
bin/build
1210

1311
## What happened
1412

@@ -17,25 +15,38 @@ bin/build
1715

1816
Here's an example of some things to check after running the build script:
1917

20-
```
21-
$ ls pkg/demo.war
22-
pkg/demo.war
23-
$ docker images
24-
REPOSITORY TAG IMAGE ID CREATED SIZE
25-
demo-java latest 88092dfb7325 6 minutes ago 591MB
26-
tomcat 8.5 a92c139758db 2 weeks ago 558MB
27-
$
28-
```
18+
$ ls pkg/demo.war
19+
pkg/demo.war
20+
$ docker images
21+
REPOSITORY TAG IMAGE ID CREATED SIZE
22+
demo-java latest 88092dfb7325 6 minutes ago 591MB
23+
tomcat 8.5 a92c139758db 2 weeks ago 558MB
24+
$
2925

3026
## Run
3127

3228
To run and test that Tomcat is serving the the war file:
3329

34-
```
35-
docker run --rm -p 8080:8080 demo-java
36-
```
37-
38-
Then you can hit the the [HOSTNAME]:8080/demo/Hello and to verify that Tomcat is servering the demo.war file. You should see an html page that says "Hello World"
30+
docker run --rm -p 8080:8080 -d demo-java
31+
docker exec -ti $(docker ps -ql) bash
32+
curl localhost:8080/demo/Hello
33+
exit
34+
docker stop $(docker ps -ql)
35+
36+
Then you can hit the the [HOSTNAME]:8080/demo/Hello and to verify that Tomcat is servering the demo.war file. You should see an html page that says "Hello World". The output should look similar:
37+
38+
$ docker run --rm -p 8080:8080 -d demo-java
39+
5ccc23ec07f2057ee530b9ad51714d4f07054d5c101ae407715aca33e5fffd69
40+
$ docker exec -ti $(docker ps -ql) bash
41+
root@5ccc23ec07f2:/usr/local/tomcat# curl localhost:8080/demo/Hello
42+
<h1>Hello World</h1>
43+
root@5ccc23ec07f2:/usr/local/tomcat# exit
44+
exit
45+
$ docker stop $(docker ps -ql)
46+
5ccc23ec07f2
47+
$ docker ps -a
48+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
49+
$
3950

4051
## Usage with UFO
4152

@@ -49,13 +60,11 @@ Change were made like adding a simple [Hello.java](src/main/java/Hello.java) Ser
4960

5061
The original command was:
5162

52-
``` sh
53-
mvn archetype:generate \
54-
-DinteractiveMode=false \
55-
-DgroupId=com.domain \
56-
-DartifactId=demo \
57-
-DarchetypeArtifactId=maven-archetype-webapp
58-
```
63+
mvn archetype:generate \
64+
-DinteractiveMode=false \
65+
-DgroupId=com.domain \
66+
-DartifactId=demo \
67+
-DarchetypeArtifactId=maven-archetype-webapp
5968

6069
## Dependencies
6170

0 commit comments

Comments
 (0)