File tree 2 files changed +41
-0
lines changed
2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM docker.io/bitnami/node:22
2
+
3
+ # Copy the app
4
+ COPY app/ /app
5
+
6
+ WORKDIR /app
7
+ # Install depencencies (express)
8
+ RUN npm install
9
+
10
+ # Port to be exposed in the container
11
+ EXPOSE 3000
12
+
13
+ # Run the app
14
+ CMD node app.js
Original file line number Diff line number Diff line change @@ -70,3 +70,30 @@ $ curl http://localhost:3000/
70
70
< /html>
71
71
```
72
72
73
+ ## Building the container image
74
+
75
+ ``` bash
76
+ $ docker build -t webapp:v0 .
77
+ ```
78
+
79
+ ### Testing the container image
80
+
81
+ ``` bash
82
+ $ docker run --name mywebapp --rm -p 3000:3000 -e WEBAPP_STRING=' Hello world !!' webapp:v0
83
+ Server running on port 3000
84
+ ```
85
+
86
+ ``` bash
87
+ $ curl http://localhost:3000/
88
+
89
+ < html>
90
+ < head>
91
+ < title> Environment Variable and Server Hostname< /title>
92
+ < /head>
93
+ < body>
94
+ < p> WEBAPP_STRING Environment Variable: Hello world !! < /p>
95
+ < p> Server Hostname: aa44cd3a60de< /p>
96
+ < /body>
97
+ < /html>
98
+
99
+ ```
You can’t perform that action at this time.
0 commit comments