24 lines
541 B
Docker
24 lines
541 B
Docker
# ---- Build stage ----
|
|
FROM node:20-alpine AS build
|
|
WORKDIR /app
|
|
|
|
COPY package.json package-lock.json ./
|
|
RUN npm ci
|
|
|
|
COPY . .
|
|
# VITE_API_BASE_URL is intentionally left unset: nginx.conf proxies /api/*
|
|
# to the backend container, so the built app can keep using relative
|
|
# same-origin requests (see src/api/client.js).
|
|
RUN npm run build
|
|
|
|
# ---- Serve stage ----
|
|
FROM nginx:alpine
|
|
WORKDIR /usr/share/nginx/html
|
|
|
|
RUN rm -rf ./*
|
|
COPY --from=build /app/dist/ .
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|