Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,27 @@ VITE_API_BASE_URL=http://localhost:8088/api

# Optional: Analytics
# VITE_ANALYTICS_ID=

# -----------------------------------------------------------------------------
# TTS Providers
# -----------------------------------------------------------------------------
# Default provider used when a request omits `provider`. Edge TTS works
# out of the box (no key required). To enable the Mi (Xiaomi) provider,
# set both MI_TTS_ENDPOINT and MI_TTS_API_KEY. These are read by the
# Python tts-service and shared across all users.

# TTS_DEFAULT_PROVIDER=edge
TTS_SERVICE_URL=http://localhost:5000
TTS_AUDIO_CACHE_DIR=./data/audio
# TTS_PORT=5000

# Edge TTS — public, no key needed
EDGE_TTS_ENABLED=1

# Mi / Xiaomi TTS — fill in to enable
# Get the endpoint & API key from your Xiaomi Cloud / Mi AI integration.
# Primary (recommended):
TTS_MIMO_API_TOKEN=sk-xxxxxxxxxxxxxxxxxxxx
TTS_MIMO_MODEL=mimo-v2.5-tts
TTS_MIMO_ENDPOINT=https://api.xiaomimimo.com/v1

10 changes: 3 additions & 7 deletions .github/workflows/android-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ on:
- "v*.*.*"
workflow_dispatch:

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
Expand Down Expand Up @@ -41,11 +42,6 @@ jobs:
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
run: pnpm install --no-frozen-lockfile

- name: Prebuild Android
run: |
cd apps/mobile
npx expo prebuild --clean --platform android

- name: Build Android APK
run: |
cd apps/mobile/android
Expand Down
15 changes: 4 additions & 11 deletions .github/workflows/feat-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ on:
- "feat/test"
workflow_dispatch:

permissions:
contents: write

jobs:
build-desktop:
name: Build Desktop (${{ matrix.platform }})
permissions:
contents: write
strategy:
matrix:
include:
Expand Down Expand Up @@ -69,8 +70,6 @@ jobs:
build-android:
name: Build Android
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -100,11 +99,6 @@ jobs:
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
run: pnpm install --no-frozen-lockfile

- name: Prebuild Android
run: |
cd apps/mobile
npx expo prebuild --platform android

- name: Build Android APK
run: |
cd apps/mobile/android
Expand All @@ -129,5 +123,4 @@ jobs:
draft: true
files: |
${{ steps.prepare_apk.outputs.apk_path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 18 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ credentials.json
# Docker
.docker/

# Prisma
apps/server/prisma/migrations/

# Test
coverage/
Expand All @@ -42,4 +40,21 @@ coverage/
my-release-key.jks

ebooks/
covers/
covers/

.claude

.tts-cache

# Python bytecode / cache
__pycache__/
*.py[cod]
*$py.class
*.egg-info/
.eggs/
build/
.pytest_cache/
.mypy_cache/
.ruff_cache/
venv/
.venv/
44 changes: 12 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,54 +78,32 @@ RUN SOURCE_PRISMA=$(find /app/node_modules/.pnpm -path '*/@prisma+client@*/node_
cp -r "$SOURCE_PRISMA" "$TARGET_PRISMA/"; \
fi

# ── Stage 4: TTS Model Downloader ────────────────────────────────────────────
FROM python:${PYTHON_VERSION}-slim AS tts-model-builder

RUN apt-get update && apt-get install -y --no-install-recommends curl && rm -rf /var/lib/apt/lists/*

# Download default voice model (HuggingFace - GitHub release 404)
ENV PIPER_MODEL_URL="https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx"
ENV PIPER_MODEL_JSON_URL="https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/lessac/medium/en_US-lessac-medium.onnx.json"

RUN mkdir -p /models && \
curl -L --fail -o /models/voice.onnx "$PIPER_MODEL_URL" && \
curl -L --fail -o /models/voice.onnx.json "$PIPER_MODEL_JSON_URL"


# ── Stage 5: Production Runner ───────────────────────────────────────────────
FROM node:${NODE_VERSION}-bookworm AS runner

LABEL org.opencontainers.image.title="BookDock"
LABEL org.opencontainers.image.description="BookDock all-in-one: API + Web + TTS"
LABEL org.opencontainers.image.description="BookDock all-in-one: API + Web + TTS (Edge/Mi)"
LABEL maintainer="BookDock Team"

WORKDIR /app

# Install Python 3.11, pip, runtime deps, and TTS Python packages directly
# Install Python 3.11, pip, runtime deps, and TTS Python packages.
# Edge TTS only needs stdlib + httpx; no heavy native deps.
RUN apt-get update && apt-get install -y --no-install-recommends \
python3.11 \
python3-pip \
python3.11-venv \
libespeak1 \
libsndfile1 \
espeak-ng \
sox \
libsox-fmt-mp3 \
supervisor \
tini \
&& rm -rf /var/lib/apt/lists/* \
&& pip3 install --break-system-packages --no-cache-dir \
piper-tts \
onnxruntime \
edge-tts \
httpx \
fastapi \
uvicorn \
pydantic \
aiofiles \
&& npm install -g prisma@5.22.0

# Copy voice model
COPY --from=tts-model-builder /models /models

# Copy deployed server (self-contained with all deps)
COPY --from=server-builder /app/server-deploy ./

Expand All @@ -149,9 +127,12 @@ ENV DATABASE_URL=file:/data/db/bookdock.db
ENV NAS_EBOOK_PATH=/data/ebooks
ENV NAS_AUDIO_PATH=/data/audio
ENV SOURCE_LOCAL_PATH=/data/sources
ENV PIPER_VOICE_PATH=/models/voice.onnx
ENV PIPER_SAMPLE_RATE=22050
ENV PIPER_PORT=5000
ENV TTS_SERVICE_URL=http://localhost:5000
ENV TTS_DEFAULT_PROVIDER=edge
ENV TTS_AUDIO_CACHE_DIR=/data/audio
ENV TTS_PORT=5000
ENV EDGE_TTS_ENABLED=1
ENV MI_TTS_ENABLED=1

# Write supervisord config
RUN cat > /etc/supervisor/conf.d/bookdock.conf << 'EOF'
Expand All @@ -162,14 +143,13 @@ logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid

[program:tts]
command=python3 -m uvicorn tts_service:app --host 0.0.0.0 --port 5000 --app-dir /app/tts-service
command=/app/tts-service/start.sh
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
environment=PIPER_VOICE_PATH="/models/voice.onnx",PIPER_SAMPLE_RATE="22050",PIPER_PORT="5000"

[program:api]
command=node /app/dist/main.js
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ function AppLayout({ children }: { children: React.ReactNode }) {
<main
className={
isReaderPage || isLoginPage
? ""
? "h-screen flex flex-col"
: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8 pb-24 md:pb-8"
}
>
Expand Down
Loading
Loading