23 lines
611 B
Docker
23 lines
611 B
Docker
# Step 1: Use an official Node.js runtime as a parent image
|
|
FROM node:latest
|
|
|
|
# Step 2: Set the working directory in the container
|
|
WORKDIR /usr/src/app
|
|
|
|
# Step 3: Copy package.json and package-lock.json (or yarn.lock)
|
|
COPY package*.json ./
|
|
|
|
RUN npm config set fetch-retry-maxtimeout 6000000 && npm config set fetch-retry-mintimeout 1000000
|
|
# Step 4: Install dependencies
|
|
RUN npm install --no-audit
|
|
|
|
# Step 5: Copy the rest of your app's source code
|
|
COPY . .
|
|
|
|
# Step 6: Build the app
|
|
RUN npm run build
|
|
|
|
# Step 7: Install serve and serve the production build
|
|
RUN npm install -g serve
|
|
CMD ["serve", "-s", "build"]
|