29 lines
492 B
Docker
29 lines
492 B
Docker
FROM node:16-alpine as build
|
|
|
|
# Set working directory
|
|
WORKDIR /app
|
|
|
|
# Copy package files and install dependencies
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the React app
|
|
RUN npm run build
|
|
|
|
# Production stage with Nginx
|
|
FROM nginx:alpine
|
|
|
|
# Copy built app from build stage
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
# Copy custom nginx config
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Expose port
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|