# syntax=docker/dockerfile:1 # ---------------------------------------------------------------- dependencies FROM node:24-bookworm-slim AS deps WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci # ---------------------------------------------------------------------- build FROM deps AS build WORKDIR /app COPY tsconfig.json vite.config.ts index.html ./ COPY src ./src # Vite copies public/ into dist/, so the served PDF (in-app Guide link) needs it here. COPY public ./public RUN npm run build # ------------------------------------------------------- production node_modules FROM node:24-bookworm-slim AS prod-deps WORKDIR /app ENV NODE_ENV=production COPY package.json package-lock.json ./ RUN npm ci --omit=dev && npm cache clean --force # -------------------------------------------------------------------- runtime FROM node:24-bookworm-slim AS runtime WORKDIR /app ENV NODE_ENV=production \ PORT=8787 \ HOST=0.0.0.0 \ LUMINARY_DATA=/data COPY --from=prod-deps /app/node_modules ./node_modules COPY package.json ./ COPY server ./server COPY --from=build /app/dist ./dist # Fail the build, not the first request, if the guide or the UI is missing. RUN test -f dist/index.html && test -f dist/luminary-user-guide.pdf # The catalog lives on a volume; it must be writable by the unprivileged user. RUN mkdir -p /data && chown -R node:node /data /app USER node EXPOSE 8787 VOLUME ["/data"] # node is guaranteed present, so no curl/wget needed in the image. HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \ CMD node -e "fetch('http://127.0.0.1:'+(process.env.PORT||8787)+'/api/health').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))" CMD ["node", "server/index.mjs"]