update dockerfile
This commit is contained in:
parent
7ed4512bbc
commit
b15f09e604
1 changed files with 11 additions and 6 deletions
|
|
@ -1,15 +1,20 @@
|
||||||
# frontend/Dockerfile
|
# ==== frontend/Dockerfile (production) ====
|
||||||
|
|
||||||
|
# ---------- Builder ----------
|
||||||
FROM node:20-alpine AS builder
|
FROM node:20-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci # clean install, respects lockfile
|
RUN npm ci # clean install, respects lockfile
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build # produces ./dist
|
RUN npm run build # Vite outputs to ./dist
|
||||||
|
|
||||||
# ---- Runtime image (optional) ----
|
# ---------- Runtime ----------
|
||||||
FROM nginx:stable-alpine
|
FROM nginx:stable-alpine AS runtime
|
||||||
|
|
||||||
|
# Copy the compiled assets from the builder stage
|
||||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||||
|
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
CMD ["nginx", "-g", "daemon off;"]
|
CMD ["nginx", "-g", "daemon off;"]
|
||||||
Loading…
Reference in a new issue