Files
luminary/Dockerfile
T
bhursey b34d34dacb Package a self-contained macOS app and harden serving
- Add macos/build.mjs: stages a universal .app outside the checkout, bundles
  and checksums Node, installs production deps per architecture, compiles the
  launcher shim, signs ad-hoc or with a Developer ID, and writes a zip and dmg
  with an optional notarization path.
- Serve precompressed brotli/gzip assets and split admin panels and the public
  pages out of the main bundle.
- Support HTTP range requests, and fix upload and quota accounting, gallery
  download counts and unreadable-file handling.
- Add server HTTP integration tests, a Gitea CI workflow, a catalog backup
  script and a crash screen for the UI.
2026-11-29 06:23:58 +00:00

55 lines
1.8 KiB
Docker

# 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
# The build writes the .br/.gz asset copies the server prefers to send.
COPY scripts ./scripts
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"]