Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
curso-kubernetes
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Ernesto Suarez
curso-kubernetes
Commits
8d45e77d
Commit
8d45e77d
authored
Jun 11, 2019
by
Jose Ernesto Suarez Font
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Node app showing container info
parent
6b12565c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
0 deletions
+48
-0
Dockerfile
services/node-host/Dockerfile
+6
-0
index.js
services/node-host/public/index.js
+28
-0
package.json
services/node-host/public/package.json
+14
-0
No files found.
services/node-host/Dockerfile
0 → 100644
View file @
8d45e77d
FROM
node:4.6
WORKDIR
/app
COPY
./public/ /app
RUN
npm
install
EXPOSE
3000
CMD
npm start
\ No newline at end of file
services/node-host/public/index.js
0 → 100644
View file @
8d45e77d
var
express
=
require
(
'
express
'
);
var
os
=
require
(
'
os
'
)
var
app
=
express
();
function
format
(
seconds
){
function
pad
(
s
){
return
(
s
<
10
?
'
0
'
:
''
)
+
s
;
}
var
hours
=
Math
.
floor
(
seconds
/
(
60
*
60
));
var
minutes
=
Math
.
floor
(
seconds
%
(
60
*
60
)
/
60
);
var
seconds
=
Math
.
floor
(
seconds
%
60
);
var
result
=
""
;
if
(
hours
>
0
)
{
result
=
pad
(
hours
)
+
'
hours
'
}
if
(
minutes
>
0
)
{
result
=
result
+
pad
(
minutes
)
+
'
minutes
'
}
result
=
result
+
pad
(
seconds
)
+
'
seconds
'
;
return
result
;
}
app
.
get
(
'
/
'
,
function
(
req
,
res
)
{
var
uptime
=
process
.
uptime
();
res
.
send
(
"
Hello from
"
+
os
.
hostname
()
+
"
I born
"
+
format
(
uptime
)
+
"
ago!
"
);
});
var
server
=
app
.
listen
(
3000
,
function
()
{
var
host
=
server
.
address
().
address
;
var
port
=
server
.
address
().
port
;
console
.
log
(
'
Programa de ejemplo escuchando en http://%s:%s
'
,
host
,
port
);
});
\ No newline at end of file
services/node-host/public/package.json
0 → 100644
View file @
8d45e77d
{
"name"
:
"myapp"
,
"version"
:
"0.0.1"
,
"private"
:
true
,
"scripts"
:
{
"start"
:
"node index.js"
},
"engines"
:
{
"node"
:
"^4.6.2"
},
"dependencies"
:
{
"express"
:
"^4.17.1"
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment