- replace custom DB adapter with Drizzle setup (SQLite/Postgres schemas) and add `drizzle.config.ts` plus migrations in `drizzle/` and `drizzle_pg/` - switch better-auth to drizzleAdapter, add auth helpers (`getAuthContext`, `requireAuthContext`, `requireAudiobookOwned`), and make `useAuth`/`useAuthSession` safe no-ops when auth is disabled - persist documents/audiobooks in DB with ownership checks, unclaimed fallback, and ref-counted deletes; add FS scan helper for no-auth mode - gate docx-to-pdf, library, voices, whisper, and migration endpoints behind auth when enabled - add unclaimed data scan/claim flow with `/api/user/claim`, `ClaimDataModal`, and server-side scan/claim helpers - refactor rate limiting and account deletion to use Drizzle tables (`user_tts_chars`, `user`) - run migrations via `scripts/migrate-if-auth.mjs` (auto on `pnpm start` + `pnpm migrate`), remove Docker entrypoint and old better-auth migration file - update README and lockfile for the new migration workflow and dependencies
68 lines
1.8 KiB
Docker
68 lines
1.8 KiB
Docker
# Stage 1: build whisper.cpp (no model download – the app handles that)
|
||
FROM alpine:3.23 AS whisper-builder
|
||
|
||
RUN apk add --no-cache git cmake build-base
|
||
|
||
WORKDIR /opt
|
||
|
||
ARG TARGETARCH
|
||
|
||
RUN git clone --depth 1 https://github.com/ggml-org/whisper.cpp.git && \
|
||
cd whisper.cpp && \
|
||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DGGML_NATIVE=OFF $( [ "$TARGETARCH" = "arm64" ] && echo "-DGGML_CPU_ARM_ARCH=armv8-a" || true ) && \
|
||
cmake --build build -j
|
||
|
||
|
||
# Stage 2: build the Next.js app
|
||
FROM node:lts-alpine AS app-builder
|
||
|
||
# Install pnpm globally
|
||
RUN npm install -g pnpm
|
||
|
||
# Create app directory
|
||
WORKDIR /app
|
||
|
||
# Copy package files
|
||
COPY package.json pnpm-lock.yaml ./
|
||
|
||
# Install dependencies
|
||
RUN pnpm install --frozen-lockfile
|
||
|
||
# Copy project files
|
||
COPY . .
|
||
|
||
# Build the Next.js application
|
||
RUN pnpm exec next telemetry disable
|
||
RUN pnpm build
|
||
|
||
|
||
# Stage 3: minimal runtime image
|
||
FROM node:lts-alpine AS runner
|
||
|
||
# Add runtime OS dependencies:
|
||
# - ffmpeg: required for audiobook export and word-by-word alignment (/api/whisper)
|
||
# - libreoffice-writer: required for DOCX → PDF conversion
|
||
RUN apk add --no-cache ffmpeg libreoffice-writer
|
||
|
||
# Install pnpm globally for running the app
|
||
RUN npm install -g pnpm
|
||
|
||
# App runtime directory
|
||
WORKDIR /app
|
||
|
||
# Copy built app and dependencies from the builder stage
|
||
COPY --from=app-builder /app ./
|
||
|
||
# Copy the compiled whisper.cpp build output into the runtime image
|
||
# (includes whisper-cli and its shared libraries, e.g. libwhisper.so, libggml.so)
|
||
COPY --from=whisper-builder /opt/whisper.cpp/build /opt/whisper.cpp/build
|
||
|
||
# Point the app at the compiled whisper-cli binary and ensure its libs are discoverable
|
||
ENV WHISPER_CPP_BIN=/opt/whisper.cpp/build/bin/whisper-cli
|
||
ENV LD_LIBRARY_PATH=/opt/whisper.cpp/build
|
||
|
||
# Expose the port the app runs on
|
||
EXPOSE 3003
|
||
|
||
# Start the application
|
||
CMD ["pnpm", "start"]
|