30 lines
684 B
Docker
30 lines
684 B
Docker
# ---------- Build Stage ----------
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
|
|
# Build-time env vars (Vite embeds these into the compiled JS bundle)
|
|
# Pass via: docker build --build-arg VITE_API_URL=https://api.yourdomain.com .
|
|
ARG VITE_API_URL=http://localhost:3000/api
|
|
ARG VITE_APP_NAME="VC E-Commerce Admin Panel"
|
|
ENV VITE_API_URL=$VITE_API_URL
|
|
ENV VITE_APP_NAME=$VITE_APP_NAME
|
|
|
|
RUN npm run build
|
|
|
|
|
|
# ---------- Production Stage ----------
|
|
FROM nginx:alpine
|
|
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|