|
1 | | -# Builds the BizerOS Knowledge web app image from this repository's source. |
2 | | -# The build context is the repo root, so the rebranded sources are baked into |
3 | | -# the resulting image rather than being re-cloned from upstream Logseq. |
| 1 | +# BizerOS Knowledge — multi-stage build. |
| 2 | +# Final image runs nginx (serving the notes-app SPA) and a file-api sidecar |
| 3 | +# (persisting markdown to $BRAIN_DIR, default /brain). |
4 | 4 |
|
5 | | -# Builder image |
6 | | -FROM clojure:temurin-11-tools-deps-1.11.1.1208-bullseye-slim as builder |
| 5 | +# ── Stage 1: build the notes-app SPA ───────────────────────────────────────── |
| 6 | +FROM node:22-alpine AS notes-app-builder |
| 7 | +WORKDIR /build |
| 8 | +RUN corepack enable && corepack prepare pnpm@10.33.0 --activate |
7 | 9 |
|
8 | | -ARG DEBIAN_FRONTEND=noninteractive |
| 10 | +COPY packages/notes-app/package.json packages/notes-app/pnpm-lock.yaml ./ |
| 11 | +RUN pnpm install --frozen-lockfile |
9 | 12 |
|
10 | | -# Install reqs |
11 | | -RUN apt-get update && apt-get install -y --no-install-recommends \ |
12 | | - curl \ |
13 | | - ca-certificates \ |
14 | | - apt-transport-https \ |
15 | | - gpg \ |
16 | | - build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev |
| 13 | +COPY packages/notes-app/ ./ |
| 14 | +RUN pnpm build |
17 | 15 |
|
18 | | -# install NodeJS & pnpm |
19 | | -RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - && \ |
20 | | - apt-get update && apt-get install -y nodejs && \ |
21 | | - corepack enable && corepack prepare pnpm@10.33.0 --activate |
| 16 | +# ── Stage 2: install the file-api runtime ──────────────────────────────────── |
| 17 | +FROM node:22-alpine AS file-api-builder |
| 18 | +WORKDIR /build |
| 19 | +RUN corepack enable && corepack prepare pnpm@10.33.0 --activate |
22 | 20 |
|
23 | | -WORKDIR /data |
| 21 | +COPY packages/file-api/package.json packages/file-api/pnpm-lock.yaml ./ |
| 22 | +RUN pnpm install --frozen-lockfile --prod |
| 23 | +COPY packages/file-api/src ./src |
24 | 24 |
|
25 | | -COPY . /data |
| 25 | +# ── Stage 3: runtime ───────────────────────────────────────────────────────── |
| 26 | +FROM node:22-alpine |
26 | 27 |
|
27 | | -RUN pnpm install --config.network-timeout=240000 |
| 28 | +# nginx is the front door; tini reaps zombies and forwards signals. |
| 29 | +RUN apk add --no-cache nginx tini |
28 | 30 |
|
29 | | -RUN pnpm release |
| 31 | +# SPA bundle. |
| 32 | +COPY --from=notes-app-builder /build/dist /usr/share/nginx/html |
30 | 33 |
|
31 | | -# Web App Runner image |
32 | | -FROM nginx:1.24.0-alpine3.17 |
| 34 | +# File-api source + node_modules. |
| 35 | +COPY --from=file-api-builder /build /opt/file-api |
33 | 36 |
|
34 | | -COPY --from=builder /data/static /usr/share/nginx/html |
| 37 | +# nginx + entrypoint configuration. |
| 38 | +COPY docker/nginx.conf /etc/nginx/http.d/default.conf |
| 39 | +COPY docker/entrypoint.sh /entrypoint.sh |
| 40 | +RUN chmod +x /entrypoint.sh |
| 41 | + |
| 42 | +# /brain is the markdown persistence root. Mount a host volume here. |
| 43 | +ENV BRAIN_DIR=/brain |
| 44 | +VOLUME ["/brain"] |
| 45 | + |
| 46 | +EXPOSE 80 |
| 47 | + |
| 48 | +HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \ |
| 49 | + CMD wget --quiet --tries=1 --spider http://127.0.0.1/api/health || exit 1 |
| 50 | + |
| 51 | +ENTRYPOINT ["/sbin/tini", "--", "/entrypoint.sh"] |
0 commit comments