1FROM node:10-alpine
2
3RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
4
5WORKDIR /home/node/app
6
7COPY package*.json ./
8
9USER node
10
11RUN npm install
12
13COPY --chown=node:node . .
14
15EXPOSE 8080
16
17CMD [ "node", "index.js" ]
1FROM node:12-alpine
2WORKDIR /app
3COPY package.json yarn.lock ./
4RUN yarn install --production
5COPY . .
6CMD ["node", "/app/src/index.js"]
1# Choose the Image which has Node installed already
2FROM node:alpine
3
4# COPY all the files from Current Directory into the Container
5COPY ./ ./
6
7# Install the Project Dependencies like Express Framework
8RUN npm install
9
10# Tell that this image is going to Open a Port
11EXPOSE 8080
12
13# Default Command to launch the Application
14CMD ["npm", "start"]
1FROM node:12
2
3# Create app directory
4WORKDIR /usr/src/app
5
6# Install app dependencies
7# A wildcard is used to ensure both package.json AND package-lock.json are copied
8# where available (npm@5+)
9COPY package*.json ./
10
11RUN npm install
12# If you are building your code for production
13# RUN npm ci --only=production
14
15# Bundle app source
16COPY . .
17
18EXPOSE 8080
19CMD [ "node", "server.js" ]
1FROM node:boron
2
3RUN mkdir -p /usr/src/app
4WORKDIR /usr/src/app
5
6COPY package.json /usr/src/app/
7RUN npm install
8
9COPY . /usr/src/app
10
11EXPOSE 3000
12
13CMD ["npm","start"]
14
15
1{
2 "name": "docker_web_app",
3 "version": "1.0.0",
4 "description": "Node.js on Docker",
5 "author": "First Last <first.last@example.com>",
6 "main": "server.js",
7 "scripts": {
8 "start": "node server.js"
9 },
10 "dependencies": {
11 "express": "^4.16.1"
12 }
13}