File tree Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Expand file tree Collapse file tree 3 files changed +32
-0
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ yarn-error.log
3
+ npm-debug.log
4
+ Dockerfile
5
+ .dockerignore
6
+ .git
7
+ .gitignore
8
+ testdir /privatefile
Original file line number Diff line number Diff line change
1
+ FROM node:16-alpine
2
+ VOLUME /public
3
+ WORKDIR /srv/http-server
4
+ COPY package.json package-lock.json ./
5
+ RUN npm install --production
6
+ COPY . .
7
+ EXPOSE 8080
8
+ ENTRYPOINT ["node" , "./bin/http-server" ]
Original file line number Diff line number Diff line change @@ -30,6 +30,22 @@ This will install `http-server` globally so that it may be run from the command
30
30
31
31
npm install http-server
32
32
33
+ #### Using Docker
34
+
35
+ Note: a public image is not provided currently, but you can build one yourself
36
+ with the provided Dockerfile.
37
+
38
+ 1 . Create an image
39
+ ```
40
+ docker build -t my-image .
41
+ ```
42
+ 2 . Run a container
43
+ ```
44
+ docker run -p 8080:8080 -v "${pwd}:/public" my-image
45
+ ```
46
+ In the example above we're serving the directory ` ./ ` (working directory).
47
+ If you wanted to serve ` ./test ` you'd replace ` ${pwd} ` with ` ${pwd}/test ` .
48
+
33
49
## Usage:
34
50
35
51
http-server [path] [options]
You can’t perform that action at this time.
0 commit comments