Skip to content

Instantly share code, notes, and snippets.

@mitchallen
Created March 2, 2023 03:19
Show Gist options
  • Save mitchallen/d905969194bd815d0117eee2650acb3c to your computer and use it in GitHub Desktop.
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
# 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