Spaces:
Running
Running
Upload . with huggingface_hub
Browse files- Dockerfile +18 -0
- package.json +13 -0
- server.js +17 -0
Dockerfile
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:16
|
2 |
+
|
3 |
+
# Create app directory
|
4 |
+
WORKDIR /usr/src/app
|
5 |
+
|
6 |
+
# Install app dependencies
|
7 |
+
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
8 |
+
# where available (npm@5+)
|
9 |
+
COPY package*.json ./
|
10 |
+
|
11 |
+
RUN npm install
|
12 |
+
# If you are building your code for production
|
13 |
+
# RUN npm ci --only=production
|
14 |
+
|
15 |
+
# Bundle app source
|
16 |
+
COPY . .
|
17 |
+
|
18 |
+
CMD [ "node", "server.js" ]
|
package.json
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "docker_web_app",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"description": "Node.js on Docker",
|
5 |
+
"author": "First Last <[email protected]>",
|
6 |
+
"main": "server.js",
|
7 |
+
"scripts": {
|
8 |
+
"start": "node server.js"
|
9 |
+
},
|
10 |
+
"dependencies": {
|
11 |
+
"express": "^4.16.1"
|
12 |
+
}
|
13 |
+
}
|
server.js
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
'use strict';
|
2 |
+
|
3 |
+
const express = require('express');
|
4 |
+
|
5 |
+
// Constants
|
6 |
+
const PORT = 7860;
|
7 |
+
const HOST = '0.0.0.0';
|
8 |
+
|
9 |
+
// App
|
10 |
+
const app = express();
|
11 |
+
app.get('/', (req, res) => {
|
12 |
+
res.send('Hello World from ExpressJS! This example is from the NodeJS Docs: https://nodejs.org/en/docs/guides/nodejs-docker-webapp/');
|
13 |
+
});
|
14 |
+
|
15 |
+
app.listen(PORT, HOST, () => {
|
16 |
+
console.log(`Running on http://${HOST}:${PORT}`);
|
17 |
+
});
|