Created
March 2, 2023 03:19
-
-
Save mitchallen/d905969194bd815d0117eee2650acb3c to your computer and use it in GitHub Desktop.
A simple Docker file for turning a NodeJS Web project into a container
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
| # Use an official Node.js runtime as a parent image | |
| FROM node:14 | |
| # Set the working directory to /app | |
| WORKDIR /app | |
| # Copy package.json and package-lock.json to the container | |
| COPY package*.json ./ | |
| # Install dependencies | |
| RUN npm install | |
| # Copy the rest of the application code to the container | |
| COPY . . | |
| # Set the container's default command to start the server | |
| CMD ["node", "server.js"] | |
| # Expose port 3000 | |
| EXPOSE 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment