Changes between Version 4 and Version 5 of Nodejs


Ignore:
Timestamp:
11/10/22 07:16:00 (2 years ago)
Author:
krit
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Nodejs

    v4 v5  
    4242}}}
    4343
     443.create Dockerfile with following content
     45{{{
     46FROM node:16
    4447
     48# Create app directory
     49WORKDIR /usr/src/app
     50
     51# Install app dependencies
     52# A wildcard is used to ensure both package.json AND package-lock.json are copied
     53# where available (npm@5+)
     54COPY package*.json ./
     55
     56RUN npm install
     57# If you are building your code for production
     58# RUN npm ci --only=production
     59
     60# Bundle app source
     61COPY . .
     62
     63EXPOSE 8080
     64CMD [ "node", "server.js" ]
     65}}}
     66
     674. Create a .dockerignore file in the same directory as your Dockerfile with following content:
     68{{{
     69node_modules
     70npm-debug.log
     71}}}
     72This will prevent your local modules and debug logs from being copied onto your Docker image and possibly overwriting modules installed within your image.
     73
     74