Skip to content

Instantly share code, notes, and snippets.

@Bucephalus-lgtm
Created February 12, 2023 05:44
Show Gist options
  • Save Bucephalus-lgtm/faab88b9ae8adc8c8dceb62a44f67811 to your computer and use it in GitHub Desktop.
Save Bucephalus-lgtm/faab88b9ae8adc8c8dceb62a44f67811 to your computer and use it in GitHub Desktop.

Dockerize the app using the Alpine Version 16 of Node.js

Dockerfile

# Use an existing image, node:16-alpine in this case as the base image
FROM node:16-alpine

# Set the working directory in the container
WORKDIR /app

# Copy the package.json and package-lock.json files into the container
COPY package*.json ./

# Install all required dependencies
RUN npm install

# Copy all codes into the container
COPY . .

# Expose the port for the Node.js app
EXPOSE 3000

# Run the app when the container starts
CMD ["npm", "start"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment