Last active
December 26, 2018 07:51
-
-
Save SaadAAkash/0c1da838f20cdd57ed5e6abce58fb01b to your computer and use it in GitHub Desktop.
For NodeJS App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# FROM defines the base image, means it defines from what image we want to build it from | |
# Create a layer from the node:8 Docker Image | |
FROM node:8 | |
# A LABEL is a key-value pair, used to store information | |
# Set one/multiple labels on one/multiple lines | |
LABEL com.example.version="0.1.1-beta" com.example.release-date="2018-12-25" com.example.version.is-production="" | |
LABEL vendor1="Medium Incorporated" | |
# Create the app directory for storing, running package manager and launch app | |
WORKDIR /usr/src/app | |
# Copy app dependencies | |
# from both package.json AND package-lock.json | |
# to the root of the docker image directory created above | |
COPY package*.json ./ | |
# Install app dependencies | |
RUN npm install | |
# For production, the command should be | |
# RUN npm install --only=production | |
# Bundle app source inside Docker image | |
COPY . . | |
# EXPOSE informs Docker that the container listens on the specified network ports at runtime | |
# provide access to this isolated docker container | |
EXPOSE 8080 | |
# Lastly, define the command to run the app | |
CMD [ "npm", "start" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment