Set up initial frontend with Vite and integrated Docker for full-stack build
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Build context : racine du projet (budget-commun/)
|
||||
|
||||
# ── Stage 1 : Build React ─────────────────────────────────────
|
||||
FROM node:20-alpine AS frontend-builder
|
||||
WORKDIR /build
|
||||
COPY frontend/package.json .
|
||||
RUN npm install
|
||||
COPY frontend .
|
||||
RUN npx vite build --outDir /dist --emptyOutDir
|
||||
|
||||
# ── Stage 2 : Backend Node.js ──────────────────────────────────
|
||||
FROM node:20-alpine
|
||||
WORKDIR /app
|
||||
COPY backend/package.json .
|
||||
RUN npm install --production
|
||||
COPY backend .
|
||||
COPY --from=frontend-builder /dist ./public
|
||||
EXPOSE 3000
|
||||
CMD ["node", "server.js"]
|
||||
Reference in New Issue
Block a user