-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
22 lines (16 loc) · 1.08 KB
/
Dockerfile
File metadata and controls
22 lines (16 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
FROM node:latest
#Pulling from Node.js because our code is written in Node. You can use any version, but in this case, since it's just CRUD, we should be safe with latest
WORKDIR /usr/src/app
#Working Directory inside the "Docker Engine" - something like a virtual computer path that we're making right now because that's how Docker works.
COPY package*.json /usr/src/app/
#Copying all our package files (Package-lock and Package, hence the wildcard * and then .json into the workdir)
RUN npm install
#Installing the dependencies inside the package files
COPY . /usr/src/app/
#Copying ALL the files (hence the wild card ".") into the working directory.
EXPOSE 8080 1337
#Exposing a port, which is 8080 and 1337, for apps to connect to. It's basically listening to the exposed port for any incoming traffic.
ENV PORT 8080
CMD ["npm", "run", "dev"]
#means that when a container is started from the image built from that Dockerfile, it will automatically start a development server for a Node.js
#application by running the dev script defined in the package.json file. This is what Bing AI said.