# 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;"] | |