Dockerizing an application
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
Containers are made up of images. Images contain your project and it's dependencies.
Add a Dockerfile to the start project. The Dockerfile should do the following...
Include a base Node image
Copy all the project files into the image
Run an npm install
Expose port 3000
Run npm start
Build the image
FROM node:10.13-alpine
ENV NODE_ENV production
ENV API_BASE https://lifx-lamp-api.azurewebsites.net/api
ENV PORT 3000
WORKDIR /usr/src/app
COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
RUN npm install --production --silent && mv node_modules ../
COPY . .
EXPOSE 3000
CMD npm start