Skip to content

Instantly share code, notes, and snippets.

@nire0510
Created November 28, 2023 09:21
Show Gist options
  • Save nire0510/07fed9867d7225a9cafdf60a63955f2b to your computer and use it in GitHub Desktop.
Save nire0510/07fed9867d7225a9cafdf60a63955f2b to your computer and use it in GitHub Desktop.
A Node.js dockerfile example
# Use an official Node.js runtime as the base image
FROM node:14
# Set environment variables
ENV NODE_ENV=production
ENV PORT=3000
# Create a work directory for the application
WORKDIR /app
# Copy package.json and package-lock.json to the work directory
COPY package*.json ./
# Install project dependencies
RUN npm install
# Copy the rest of the application code to the work directory
COPY . .
# Expose a port for the application to listen on
EXPOSE 3000
# Set the default command to start the application
CMD [ "npm", "start" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment