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
|
FROM node:20-alpine AS build
|
||||||
|
|
||||||
# ===== STAGE 1: Build =====
|
|
||||||
FROM node:22-alpine AS builder
|
|
||||||
|
|
||||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
COPY package*.json ./
|
||||||
COPY package.json pnpm-lock.yaml ./
|
RUN npm install
|
||||||
RUN --mount=type=cache,id=pnpm-marketplace,target=/pnpm/store \
|
|
||||||
pnpm install --frozen-lockfile
|
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN pnpm build
|
RUN npm run build
|
||||||
|
|
||||||
# ===== STAGE 2: Production (static-web-server ~3MB binary) =====
|
FROM node:20-alpine
|
||||||
FROM docker.io/joseluisq/static-web-server:2-alpine
|
WORKDIR /app
|
||||||
|
RUN npm install -g serve
|
||||||
COPY --from=builder /app/dist /public
|
COPY --from=build /app/dist ./dist
|
||||||
|
EXPOSE 8080
|
||||||
# SPA mode: fallback para index.html
|
CMD ["serve", "-s", "dist", "-l", "8080"]
|
||||||
ENV SERVER_FALLBACK_PAGE=/public/index.html
|
|
||||||
ENV SERVER_ROOT=/public
|
|
||||||
ENV SERVER_PORT=3000
|
|
||||||
|
|
||||||
EXPOSE 3000
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue