feat(docker): aggiungi flusso di sviluppo con hot reload via compose

Dockerfile diventa multi-stage con target `dev` (Vite + bind-mount) oltre
a `builder`/`runtime`; docker-compose.dev.yml lo usa per un ambiente di
sviluppo containerizzato equivalente a `npm run dev`, senza toccare il
compose di produzione (che resta pull-only dal registry). Documentato in
README e CLAUDE.md.
This commit is contained in:
2026-07-08 10:23:24 +02:00
parent 34c9a61e79
commit ec19eb62c3
4 changed files with 70 additions and 5 deletions
+13 -4
View File
@@ -1,13 +1,22 @@
# Stage 1: build frontend
FROM node:20-alpine AS builder
# Stage 1: dipendenze condivise (build + dev)
FROM node:20-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci
# Stage 2: dev — hot reload via Vite, sorgente montato da bind-mount
FROM deps AS dev
ENV NODE_ENV=development
EXPOSE 5173
CMD ["npm", "run", "dev"]
# Stage 3: build frontend
FROM deps AS builder
COPY . .
RUN npm run build
# Stage 2: runtime
FROM node:20-alpine
# Stage 4: runtime di produzione
FROM node:20-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production PORT=3000