32 lines
539 B
Docker
32 lines
539 B
Docker
# ---------- Build stage ----------
|
|
FROM node:20-alpine AS build
|
|
|
|
WORKDIR /app
|
|
|
|
# Install dependencies
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
# Copy source
|
|
COPY . .
|
|
|
|
# Build React app
|
|
RUN npm run build
|
|
|
|
|
|
# ---------- Production stage ----------
|
|
FROM nginx:alpine
|
|
|
|
# Remove default nginx config
|
|
RUN rm /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy custom nginx config
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy build output
|
|
COPY --from=build /app/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 3000
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|