-
Notifications
You must be signed in to change notification settings - Fork 467
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (20 loc) · 812 Bytes
/
Dockerfile
File metadata and controls
29 lines (20 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Create a dockerfile with node image
FROM node:latest
# Create a directory to hold the application code inside the image, this will be the working directory for your application
RUN mkdir -p /usr/src/app
# Set the working directory to /usr/src/app
WORKDIR /usr/src/app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
# Install npm
RUN npm install
# Copy the current directory contents into the container at /usr/src/app
COPY . .
# Make port 3000 available to the world outside this container
EXPOSE 3000
# Run Nodeserver.js when the container launches
CMD ["node", "nodeserver.js"]
# Write a docker comand to build the image and tag it as mynodeapp
#docker build -t mynodeapp .
# Write command to run docker in port 4000
#docker run -p 4000:3000 -d <image id>