Skip to content

Commit e40e8ec

Browse files
Add Dockerfile, .dockerignore and doc
1 parent 5118c2a commit e40e8ec

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.dockeringore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
dist

Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM node:16-alpine
2+
3+
WORKDIR /usr/app
4+
5+
# first copy just the package and the lock file, for caching purposes
6+
COPY package.json ./
7+
COPY yarn.lock ./
8+
9+
# install dependencies
10+
RUN yarn
11+
12+
# copy the entire project
13+
COPY . .
14+
15+
# build
16+
RUN yarn build
17+
18+
EXPOSE 3000
19+
CMD [ "yarn", "start" ]

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@
2121
- You can run `yarn dev` to combine the 2 steps above, while listening to changes and restarting automatically.
2222
- You need to run `yarn global add ts-node nodemon` once for this to run.
2323

24+
## Run with Docker
25+
26+
1. Build:
27+
28+
```
29+
docker build -t my-app .
30+
```
31+
32+
Replacing `my-app` with the image name.
33+
34+
2. Run
35+
```
36+
docker run -d -p 3000:3000 my-app
37+
```
38+
Replacing `my-app` with the image name, and `3000:3000` with the `host:container` ports to publish.
39+
2440
## Linting & Formatting
2541
2642
- Run `yarn lint` to lint the code.

0 commit comments

Comments
 (0)