Skip to content

Instantly share code, notes, and snippets.

@shamaru001
Forked from oktavianidewi/dockerize-simple-api.md
Last active September 12, 2019 21:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamaru001/c14708a1db54ba4201b1942a54d3fa70 to your computer and use it in GitHub Desktop.
Save shamaru001/c14708a1db54ba4201b1942a54d3fa70 to your computer and use it in GitHub Desktop.
Dockerize simple API from Node-JS
FROM node:9-slim
# use this directory to store files, run npm, and launch our app
WORKDIR /app
# copy application to /app directory, install dependecies.
# If you add the package.json first and run npm install later, Docker won't have to install the dependencies again if you change package.json
COPY package.json /app
RUN npm install
COPY . /app
# what should be executed when the docker image is launched.
CMD node index.js
# expose port 8081 tok the outside once the container has launched
EXPOSE 8000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment