Chysev commited on
Commit
8820311
·
verified ·
1 Parent(s): d3c27f1

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +27 -0
  2. index.js +14 -0
  3. package.json +12 -0
Dockerfile ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Node base image
2
+ FROM node:16
3
+
4
+ # Switch to the "node" user
5
+ USER node
6
+
7
+ # Set home to the user's home directory
8
+ ENV HOME=/home/node \
9
+ PATH=/home/node/.local/bin:$PATH
10
+
11
+ # Set the working directory to the user's home directory
12
+ WORKDIR $HOME/app
13
+
14
+ # Moving file to user's home directory
15
+ ADD . $HOME/app
16
+
17
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
18
+ COPY --chown=node . $HOME/app
19
+
20
+ # Loading Dependencies
21
+ RUN npm install
22
+
23
+ # Expose application's default port
24
+ EXPOSE 7860
25
+
26
+ # Entry Point
27
+ ENTRYPOINT ["nodejs", "./index.js"]
index.js ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var express = require('express');
2
+
3
+ // Constants
4
+ var DEFAULT_PORT = 7860;
5
+ var PORT = process.env.PORT || DEFAULT_PORT;
6
+
7
+ // App
8
+ var app = express();
9
+ app.get('/', function (req, res) {
10
+ res.send('Hello World\n');
11
+ });
12
+
13
+ app.listen(PORT)
14
+ console.log('Running on http://localhost:' + PORT);
package.json ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "node-hello",
3
+ "version": "0.0.1",
4
+ "description": "Node.js Hello For Huggingface",
5
+ "author": "Rahul Kiran Gaddam",
6
+ "dependencies": {
7
+ "express": "4.16.1"
8
+ },
9
+ "scripts": {
10
+ "start": "node ./index.js"
11
+ }
12
+ }