Skip to content

Instantly share code, notes, and snippets.

@ValeryVerkhoturov
Created April 20, 2025 09:49
Show Gist options
  • Save ValeryVerkhoturov/8acdbad35fc04450aeefafffdcf4f712 to your computer and use it in GitHub Desktop.
Save ValeryVerkhoturov/8acdbad35fc04450aeefafffdcf4f712 to your computer and use it in GitHub Desktop.
Dockerfile for SPA (Ex.: Vite)
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm i --force
COPY . .
RUN npm run build
FROM node:20-alpine AS runner
WORKDIR /app
RUN npm install -g serve
COPY --from=builder /app/dist ./dist
EXPOSE 4173
CMD ["serve", "-s", "dist", "-l", "4173", "--no-clipboard"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment