Skip to content

Instantly share code, notes, and snippets.

@algonacci
Created April 11, 2024 06:22
Show Gist options
  • Save algonacci/cd0576ebbf68040d9a0c4bc9e1b22866 to your computer and use it in GitHub Desktop.
Save algonacci/cd0576ebbf68040d9a0c4bc9e1b22866 to your computer and use it in GitHub Desktop.
A simple Dockerfile to deploy a Vite-based frontend app
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM node:lts-alpine as serve-stage
WORKDIR /app
RUN npm install -g serve
COPY --from=build-stage /app/dist /app/dist
EXPOSE 8080
CMD ["serve", "-s", "dist", "-l", "8080"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment