# syntax=docker/dockerfile:1.7 # ---------- build stage ---------- FROM node:20-alpine AS build WORKDIR /app # Install deps in their own layer so source changes don't bust the cache. COPY package.json package-lock.json* ./ RUN npm ci # PB URL is baked at build time — Vite reads it via import.meta.env.VITE_*. # Set this as a build arg in Coolify (or docker compose). ARG VITE_POCKETBASE_URL ENV VITE_POCKETBASE_URL=$VITE_POCKETBASE_URL # n8n base URL for deep-links from each failure/execution back to n8n. ARG VITE_N8N_URL ENV VITE_N8N_URL=$VITE_N8N_URL COPY . . RUN npm run build # ---------- runtime stage ---------- FROM nginx:1.27-alpine # Replace default site config with our SPA-friendly one. RUN rm /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/ # Static bundle from the build stage. COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 # Coolify/Traefik will route to this port; the page itself is served by nginx. CMD ["nginx", "-g", "daemon off;"]