Created
January 31, 2021 12:35
-
-
Save jmaicaaan/6e0b4b50012b56f949260b06d72174dd to your computer and use it in GitHub Desktop.
[Tutorial] Dockerizing Next.js - Dockerfile
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
# base image | |
FROM node:14.15.4-alpine | |
# Create and change to the app directory. | |
WORKDIR /usr/app | |
# Copy application dependency manifests to the container image. | |
# A wildcard is used to ensure copying both package.json AND package-lock.json (when available). | |
# Copying this first prevents re-running npm install on every code change. | |
COPY . . | |
# Install production dependencies. | |
# If you add a package-lock.json, speed your build by switching to 'npm ci'. | |
RUN npm ci --only=production | |
# Copy local code to the container image. | |
RUN npm run build | |
# Run the web service on container startup. | |
CMD [ "npm", "start" ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment