File size: 483 Bytes
4888678 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# Dockerfile.frontend
# Step 1: Build React App
FROM node:18-alpine AS build
WORKDIR /app
# Copy only package files and install dependencies
COPY frontend/package*.json ./
RUN npm install
# Copy all frontend source code
COPY frontend/ ./
# Run React build
RUN npm run build
# Step 2: Serve with Nginx
FROM nginx:alpine
# Copy built files from step 1
COPY --from=build /app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
|