Files
2026-07-13 13:20:22 +08:00

48 lines
1.3 KiB
Docker

FROM node:20-slim AS builder
WORKDIR /app
# Install bun
RUN npm install -g bun
# Install all dependencies (including devDeps for build)
COPY package.json bun.lock ./
COPY patches/ ./patches/
RUN bun install --ignore-scripts
# Copy source
COPY . .
# Build renderer (no Electron needed) and server bundle
RUN bun run build:renderer:web
RUN node scripts/build-server.mjs
# ---- Runtime image ----
FROM oven/bun:latest AS runtime
WORKDIR /app
# officecli (the Office preview component, auto-installed at runtime by the
# backend) is a .NET binary that aborts on startup without ICU, and Debian
# base images don't ship it. libicu-dev is version-agnostic so it keeps
# resolving the right libicuNN when the base image bumps Debian releases.
RUN apt-get update \
&& apt-get install -y --no-install-recommends libicu-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy only build artifacts and production deps
COPY --from=builder /app/dist-server ./dist-server
COPY --from=builder /app/out/renderer ./out/renderer
COPY package.json bun.lock ./
COPY patches/ ./patches/
RUN bun install --production --ignore-scripts
ENV PORT=3000
ENV NODE_ENV=production
ENV ALLOW_REMOTE=true
ENV DATA_DIR=/data
# SQLite data volume — mount with: -v $(pwd)/data:/data
VOLUME ["/data"]
EXPOSE 3000
CMD ["bun", "dist-server/server.mjs"]