logseq-sync/Dockerfile

54 lines
1 KiB
Docker

FROM node:25-alpine3.22 AS builder
WORKDIR /build
RUN apk add --no-cache \
bash \
ca-certificates \
openjdk21-jre-headless \
git \
curl
RUN npm install -g corepack --force && corepack enable
# Install Clojure
RUN curl -LO https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh \
&& chmod +x linux-install.sh \
&& ./linux-install.sh
# Clone Logseq
RUN git clone https://github.com/logseq/logseq.git --depth 1
WORKDIR /build/logseq
RUN pnpm install
# Build db-sync
WORKDIR /build/logseq/deps/db-sync
RUN pnpm install \
&& pnpm build:node-adapter \
&& pnpm install --production
# Prepare runtime files
RUN mkdir -p /logseq-sync/worker \
&& mv worker/dist /logseq-sync/worker \
&& mv node_modules package.json start.sh /logseq-sync
# ---------- Final stage ----------
FROM node:25-alpine3.22
WORKDIR /logseq-sync
RUN apk add --no-cache \
bash \
curl
COPY --from=builder /logseq-sync /logseq-sync
EXPOSE 8787
HEALTHCHECK CMD curl --fail http://localhost:8787/health || exit 1
CMD ["bash", "start.sh"]