| |
| |
| FROM node:20-alpine AS builder |
|
|
| WORKDIR /app |
|
|
| |
| COPY package.json package-lock.json ./ |
| RUN npm ci |
|
|
| |
| ARG VITE_API_URL=http://localhost:8000 |
| ENV VITE_API_URL=${VITE_API_URL} |
|
|
| |
| COPY . . |
| RUN npm run build |
|
|
| |
| FROM nginx:alpine AS production |
|
|
| LABEL maintainer="SmartClass Team" |
| LABEL description="SmartClass Frontend - React + Nginx" |
|
|
| |
| COPY nginx.conf /etc/nginx/conf.d/default.conf |
|
|
| |
| COPY --from=builder /app/dist /usr/share/nginx/html |
|
|
| |
| EXPOSE 80 |
|
|
| |
| HEALTHCHECK --interval=15s --timeout=5s --retries=3 \ |
| CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:80/ || exit 1 |
|
|
| CMD ["nginx", "-g", "daemon off;"] |
|
|