Add Dockerfile for Vite frontend (GHJ deploy pattern)

This commit is contained in:
Gemini CLI 2026-02-28 09:15:59 -06:00
parent dd52e94e94
commit 034ab72fb4

View file

@ -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"]