Add Dockerfile for Vite frontend (GHJ deploy pattern)
This commit is contained in:
parent
dd52e94e94
commit
034ab72fb4
1 changed files with 10 additions and 23 deletions
|
|
@ -1,26 +1,13 @@
|
|||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ===== STAGE 1: Build =====
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
FROM node:20-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN --mount=type=cache,id=pnpm-marketplace,target=/pnpm/store \
|
||||
pnpm install --frozen-lockfile
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
RUN pnpm build
|
||||
RUN npm run build
|
||||
|
||||
# ===== STAGE 2: Production (static-web-server ~3MB binary) =====
|
||||
FROM docker.io/joseluisq/static-web-server:2-alpine
|
||||
|
||||
COPY --from=builder /app/dist /public
|
||||
|
||||
# SPA mode: fallback para index.html
|
||||
ENV SERVER_FALLBACK_PAGE=/public/index.html
|
||||
ENV SERVER_ROOT=/public
|
||||
ENV SERVER_PORT=3000
|
||||
|
||||
EXPOSE 3000
|
||||
FROM node:20-alpine
|
||||
WORKDIR /app
|
||||
RUN npm install -g serve
|
||||
COPY --from=build /app/dist ./dist
|
||||
EXPOSE 8080
|
||||
CMD ["serve", "-s", "dist", "-l", "8080"]
|
||||
|
|
|
|||
Loading…
Reference in a new issue