Skip to content

Commit 2c00dff

Browse files
authored
Update README.md
1 parent 8872248 commit 2c00dff

File tree

1 file changed

+52
-3
lines changed

1 file changed

+52
-3
lines changed

README.md

+52-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,66 @@
22

33
1. Navigate to the directory and run the below maven command to build the war file as
44
```
5-
mvn clean verify
5+
$mvn clean verify
6+
7+
[INFO] Scanning for projects...
8+
[INFO]
9+
[INFO] ------------------------------------------------------------------------
10+
[INFO] Building Example 0.0.1-SNAPSHOT
11+
[INFO] ------------------------------------------------------------------------
12+
[INFO]
13+
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Example ---
14+
[INFO]
15+
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Example ---
16+
[INFO] Using 'UTF-8' encoding to copy filtered resources.
17+
[INFO] skip non existing resourceDirectory /Users/prem/Desktop/codebase/java-maven-sample-war/src/main/resources
18+
[INFO]
19+
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ Example ---
20+
[INFO] Changes detected - recompiling the module!
21+
[INFO] Compiling 1 source file to /Users/prem/Desktop/codebase/java-maven-sample-war/target/classes
22+
[INFO]
23+
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ Example ---
24+
[INFO] Using 'UTF-8' encoding to copy filtered resources.
25+
[INFO] skip non existing resourceDirectory /Users/prem/Desktop/codebase/java-maven-sample-war/src/test/resources
26+
[INFO]
27+
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ Example ---
28+
[INFO] No sources to compile
29+
[INFO]
30+
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Example ---
31+
[INFO] No tests to run.
32+
[INFO]
33+
[INFO] --- maven-war-plugin:2.5:war (default-war) @ Example ---
34+
[INFO] Packaging webapp
35+
[INFO] Assembling webapp [Example] in [/Users/prem/Desktop/codebase/java-maven-sample-war/target/Example-0.0.1-SNAPSHOT]
36+
[INFO] Processing war project
37+
[INFO] Copying webapp resources [/Users/prem/Desktop/codebase/java-maven-sample-war/src/main/webapp]
38+
[INFO] Webapp assembled in [69 msecs]
39+
[INFO] Building war: /Users/prem/Desktop/codebase/java-maven-sample-war/target/Example-0.0.1-SNAPSHOT.war
40+
[INFO] ------------------------------------------------------------------------
41+
[INFO] BUILD SUCCESS
42+
[INFO] ------------------------------------------------------------------------
43+
[INFO] Total time: 3.698 s
44+
[INFO] Finished at: 2018-10-31T20:12:34+05:30
45+
[INFO] Final Memory: 16M/139M
46+
[INFO] ------------------------------------------------------------------------
647
```
748
Once the above is completed the file Example-0.0.1-SNAPSHOT.war will be created under target/ folder
849

950
2. Now its time for docker, first build the docker image as below command, make sure you are running from the directory which have Dockerfile, otherwise add the dockerfile with path and name in the command too
1051
```
11-
docker build -t tomcat-sample:1.0 .
52+
$docker build -t tomcat-sample:1.0 .
53+
54+
Sending build context to Docker daemon 271.9kB
55+
Step 1/2 : FROM tomcat:8.0.20-jre8
56+
---> e88a065848be
57+
Step 2/2 : COPY target/Example-0.0.1-SNAPSHOT.war /usr/local/tomcat/webapps/sample.war
58+
---> 68da124851e4
59+
Successfully built 68da124851e4
60+
Successfully tagged tomcat-sample:1.0
1261
```
1362
3. Start the above created image with the below docker command
1463
```
15-
docker run --name tomcat -it --rm -d -p 8080:8080 tomcat-sample:1.0
64+
$docker run --name tomcat -it --rm -d -p 8080:8080 tomcat-sample:1.0
1665
```
1766
4. Navigate to http://localhost:8080/sample/ to check the started docker image with above created war file.
1867

0 commit comments

Comments
 (0)