Last active
December 24, 2018 07:24
-
-
Save joshuaquek/5292050d1784c71601b63735a191f2f9 to your computer and use it in GitHub Desktop.
A sample Dockerfile to deploy NodeJS locally on your own desktop machine.
This file contains hidden or 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
Summary: A sample Dockerfile and .dockerignore file to deploy NodeJS locally on your own desktop machine. |
This file contains hidden or 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
node_modules | |
npm-debug.log |
This file contains hidden or 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
# specify the node base image with your desired version node:<version> | |
FROM node:10-alpine | |
# Set the working directory to /app | |
WORKDIR /app | |
# Only run NPM Install if package.json changes (this allows node_modules to be cached) | |
COPY package.json /app/package.json | |
RUN cd /app; npm install | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Ports to expose to local machine | |
EXPOSE 8080 7501 9001 | |
# Place the NPM script that you want to run over here: | |
RUN npm run staging |
This file contains hidden or 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
#!/bin/bash | |
docker build -t myapp-image .; docker run -it --rm --name myapp-instance myapp-image ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment