M3S / Dockerfile
p3rc03's picture
Update Dockerfile
1aff9ad verified
# ────────────────────────────────────────────────────────────────────────────────
# Stage 1: build the app
# ────────────────────────────────────────────────────────────────────────────────
FROM node:18-alpine AS builder
WORKDIR /app
# copy package manifests
COPY package.json package-lock.json ./
COPY vite.config.ts ./
COPY tsconfig.json ./
# install deps, ignoring peer conflicts
RUN npm install
# copy source & build
COPY . .
RUN npm run build
# ────────────────────────────────────────────────────────────────────────────────
# Stage 2: serve the build
# ────────────────────────────────────────────────────────────────────────────────
FROM node:18-alpine AS runner
WORKDIR /app
# lightweight static server
RUN npm install -g serve
# copy built assets
COPY --from=builder /app/dist ./dist
EXPOSE 3000
CMD ["serve", "-s", "dist", "-l", "3000"]