usse/react_usse/Dockerfile

23 lines
611 B
Docker
Raw Permalink Normal View History

2023-12-27 22:04:07 +00:00
# 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 ./
2024-04-15 19:31:08 +00:00
RUN npm config set fetch-retry-maxtimeout 6000000 && npm config set fetch-retry-mintimeout 1000000
2023-12-27 22:04:07 +00:00
# Step 4: Install dependencies
2024-04-15 19:31:08 +00:00
RUN npm install --no-audit
2023-12-27 22:04:07 +00:00
# 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"]