Processing math: 100%

Wednesday, May 20, 2020

Docker Exercise

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
FROM node:14.2.0-alpine3.10
 
EXPOSE 3000
 
RUN apk add --update tini
 
RUN mkdir -p /usr/src/app
 
WORKDIR /usr/src/app
 
COPY package.json package.json
 
RUN npm install
 
COPY . .
 
CMD ["tini", "--", "node", "./bin/www"]
cd into the directory that contains the above as Dockerfile, and run
1
docker build -t testnode
The above will be built as an image and tagged with testnode. After we make sure testnode can be run properly (by running docker container run --rm -p 80:3000 testnode), we change the tag name as follows:
1
docker tag testnode machingclee/testnode
and then
1
docker push machingclee/testnode
if we want.

No comments:

Post a Comment