Created
February 4, 2019 01:59
-
-
Save angeloreale/aa878acfb584458467dc5846dafcd68a to your computer and use it in GitHub Desktop.
Dockerizing a Node.js and MongoDB app with CI/CD Pipelines on Gitlab for staging and production environments.
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
# Use an official Node runtime as a parent image | |
FROM node:latest | |
# Set the working directory to /app | |
WORKDIR /app | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Install any needed packages specified in package.json as well as PM2 to ensure the app integrity. | |
RUN npm install | |
RUN npm install pm2 -g | |
# Make port 80 available to the world outside this container | |
EXPOSE 80 | |
# Run app.js under PM2 when the container launches | |
CMD ["pm2-runtime", "app.js"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment