first commit
This commit is contained in:
42
frontend/Dockerfile
Normal file
42
frontend/Dockerfile
Normal file
@@ -0,0 +1,42 @@
|
||||
# ╔══════════════════════════════════════════════╗
|
||||
# ║ Frontend Dockerfile – multi-stage ║
|
||||
# ╚══════════════════════════════════════════════╝
|
||||
|
||||
# ── Stage 1: deps ────────────────────────────────
|
||||
FROM node:22-alpine AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json* ./
|
||||
RUN npm install && npm cache clean --force
|
||||
|
||||
# ── Stage 2: development (hot reload) ────────────
|
||||
FROM deps AS development
|
||||
ARG VITE_APP_VERSION=dev
|
||||
ENV VITE_APP_VERSION=$VITE_APP_VERSION
|
||||
COPY . .
|
||||
EXPOSE 5173
|
||||
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0", "--port", "5173"]
|
||||
|
||||
# ── Stage 3: build ───────────────────────────────
|
||||
FROM deps AS builder
|
||||
ARG VITE_API_URL=/api
|
||||
ARG VITE_APP_VERSION=dev
|
||||
ENV VITE_API_URL=$VITE_API_URL
|
||||
ENV VITE_APP_VERSION=$VITE_APP_VERSION
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# ── Stage 4: production (nginx static) ───────────
|
||||
FROM nginx:1.27-alpine AS production
|
||||
LABEL maintainer="VibeFinance"
|
||||
|
||||
# Kopieer de Vite build output
|
||||
COPY --from=builder /app/dist /usr/share/nginx/html
|
||||
|
||||
# Nginx config voor SPA (history-mode fallback)
|
||||
COPY nginx-spa.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
EXPOSE 80
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \
|
||||
CMD wget -qO- http://localhost/ || exit 1
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Reference in New Issue
Block a user