Skip to content

Instantly share code, notes, and snippets.

@ashishjullia
Created September 23, 2023 11:13
Show Gist options
  • Save ashishjullia/e1aa2bff23b2646fd8f8a615a2cbd90c to your computer and use it in GitHub Desktop.
Save ashishjullia/e1aa2bff23b2646fd8f8a615a2cbd90c to your computer and use it in GitHub Desktop.
nodejs-dockerfile
# Specify the base image
FROM node:16-alpine
ARG MYSQL_HOST \
MYSQL_PORT
ENV MYSQL_HOST=$MYSQL_HOST \
MYSQL_PORT=$MYSQL_PORT
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json (if available) to the container
COPY package*.json ./
# Install project dependencies
RUN npm install
# Copy the entire project directory to the container
COPY . .
# Specify the command to run your Node.js application
CMD ["node", "index.js"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment