Created
November 28, 2023 09:21
-
-
Save nire0510/07fed9867d7225a9cafdf60a63955f2b to your computer and use it in GitHub Desktop.
A Node.js dockerfile example
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 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