- apps/api/Dockerfile: multi-stage pnpm build, runtime node:22-alpine, port 3001 - apps/web/Dockerfile: multi-stage pnpm + Vite, runtime nginx:alpine with SPA config - .dockerignore: excludes node_modules, dist, .env, .git, IDE folders, design docs - Brand logo (naturcalabacera.webp) integrated as favicon, sidebar icon, header logo - index.html title updated to 'Naturcalabacera · Reservas'
39 lines
1.1 KiB
Docker
39 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
# ───── Stage 1: build ─────
|
|
FROM node:22-alpine AS builder
|
|
WORKDIR /repo
|
|
RUN corepack enable
|
|
|
|
# Manifiestos primero (para cachear pnpm install si no cambian deps)
|
|
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
|
|
COPY packages/shared/package.json ./packages/shared/
|
|
COPY apps/api/package.json ./apps/api/
|
|
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# Código fuente
|
|
COPY packages/shared ./packages/shared
|
|
COPY apps/api ./apps/api
|
|
|
|
# Compila TypeScript del api
|
|
RUN pnpm --filter @naturcalabacera/api build
|
|
|
|
# Carpeta de despliegue self-contained con node_modules de producción
|
|
RUN pnpm --filter @naturcalabacera/api deploy --prod /out
|
|
|
|
# Copia plantillas HTML al dist (tsc no las copia)
|
|
RUN cp -r apps/api/src/templates /out/dist/templates
|
|
|
|
# ───── Stage 2: runtime ─────
|
|
FROM node:22-alpine
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
|
|
COPY --from=builder /out/dist ./dist
|
|
COPY --from=builder /out/node_modules ./node_modules
|
|
COPY --from=builder /out/package.json ./package.json
|
|
|
|
EXPOSE 3001
|
|
CMD ["node", "dist/index.js"]
|