# =========================
# Build stage
# =========================
FROM node:20-alpine AS builder

WORKDIR /app

COPY frontend/studia/package*.json ./
RUN npm ci

COPY frontend/studia/ ./
RUN npm run build


# =========================
# Runtime stage
# =========================
FROM nginx:1.27-alpine

# Remove default nginx config
RUN rm /etc/nginx/conf.d/default.conf

# Custom nginx config
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Vite build output
COPY --from=builder /app/dist /usr/share/nginx/html

EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]
