File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change
1
+ FROM node:16.17.1-alpine
2
+
3
+ LABEL maintainer="Johan Book"
4
+ LABEL title="domain-file-server"
5
+ LABEL description="File server with support for multiple domains"
6
+
7
+ WORKDIR /app
8
+ COPY . .
9
+ RUN npm ci
10
+
11
+ USER node
12
+
13
+ CMD ["node" , "server.js" ]
14
+
15
+ EXPOSE 8080
Original file line number Diff line number Diff line change 1
- # domain- file-server
1
+ # file-domain -server
2
2
3
3
_ This software has not been tested in regards of security and should not be used
4
4
in a production environment_
5
5
6
- ** domain-file-server** is a simplistic Nodejs file server supporting multiple
7
- domains. It is mainly intended to run an internal network with its own DNS server.
6
+ ** file-server-domain** is a simplistic Nodejs file server supporting multiple
7
+ domains. It is mainly intended to run an internal network with its own DNS
8
+ server.
8
9
9
10
## Configuration
10
11
@@ -27,3 +28,16 @@ build/mycat.com/favicon.ico
27
28
build/mycat.com/index.html
28
29
build/mycat.com/script.js
29
30
```
31
+
32
+ ## Docker
33
+
34
+ The server can be run through Docker
35
+
36
+ ``` sh
37
+ docker run \
38
+ --detach \
39
+ --publish 8080:8080 \
40
+ --restart unless-stopped \
41
+ --volume ${PWD} /build/:/app/build/ \
42
+ johanbook/file-domain-server:latest
43
+ ```
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ const http = require("http");
3
3
const path = require ( "path" ) ;
4
4
5
5
const DEFAULT_INDEX_FILE = process . env . DEFAULT_INDEX_FILE || "index.html" ;
6
+ const PORT = process . env . PORT || 8080 ;
6
7
const ROOT_FILE_PATH = process . env . ROOT_FILE_PATH || "build" ;
7
8
8
9
function getFile ( filePath ) {
@@ -45,9 +46,10 @@ function handleRequest(req, res) {
45
46
res . end ( ) ;
46
47
return ;
47
48
}
49
+
48
50
res . writeHead ( 200 ) ;
49
51
res . end ( file ) ;
50
52
}
51
53
52
54
const server = http . createServer ( handleRequest ) ;
53
- server . listen ( 8080 ) ;
55
+ server . listen ( PORT ) ;
You can’t perform that action at this time.
0 commit comments