28 lines
578 B
Docker
28 lines
578 B
Docker
# ---- Base Node ----
|
|
FROM node:20-alpine AS base
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
|
|
# ---- Dependencies ----
|
|
FROM base AS deps
|
|
RUN npm install --legacy-peer-deps
|
|
|
|
# ---- Builder ----
|
|
FROM deps AS builder
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# ---- Development ----
|
|
FROM deps AS dev
|
|
COPY . .
|
|
# Expose Vite's default dev port
|
|
EXPOSE 5173
|
|
CMD ["npm", "run", "dev", "--", "--host"]
|
|
|
|
# ---- Production ----
|
|
FROM nginx:alpine AS prod
|
|
# Copy the build output from Vite (usually output to /dist)
|
|
COPY --from=builder /app/dist /usr/share/nginx/html
|
|
EXPOSE 80
|
|
CMD ["nginx", "-g", "daemon off;"]
|