CA-Foundation / frontend /Dockerfile
“vinit5112”
application not start
5d2f496
raw
history blame
702 Bytes
# Stage 1: Build the React application
FROM node:18-alpine AS build
WORKDIR /app
# Copy package.json and package-lock.json
COPY package.json package-lock.json ./
# Install dependencies
RUN npm install
# Copy the rest of the application source code
COPY . .
# Build the application
RUN npm run build
# Stage 2: Serve the application with Nginx
FROM nginx:1.23-alpine
# Copy the build output from the build stage
COPY --from=build /app/build /usr/share/nginx/html
# Remove the default Nginx configuration
RUN rm /etc/nginx/conf.d/default.conf
# Copy our custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d
# Expose port 80
EXPOSE 7860
# Start Nginx
CMD ["nginx", "-g", "daemon off;"]