saveinmed/frontend/Dockerfile

26 lines
626 B
Docker

# syntax=docker/dockerfile:1
# ===== STAGE 1: Build =====
FROM node:22-alpine AS builder
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN --mount=type=cache,id=pnpm-marketplace,target=/pnpm/store \
pnpm install --frozen-lockfile
COPY . .
RUN pnpm 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