Files
simbarag/Dockerfile
T
ryan de88679f25
CI / backend (pull_request) Successful in 1m23s
CI / frontend (pull_request) Failing after 37s
CI / backend (push) Successful in 36s
CI / frontend (push) Failing after 7s
Validate production config, add CI, and build from locked dependencies
- Fail startup on unsafe or malformed production settings (scripts/validate_config.py),
  run it before migrations, and stop on a failed `aerich upgrade`.
- Forward the context-budget, timeout and metrics settings through Compose; accept
  the historical TAVILIY_API_KEY spelling.
- Build the image from uv.lock and yarn.lock in a multi-stage Dockerfile.
- Add Gitea Actions CI: Ruff, unit tests, context evaluation, frontend tests,
  typecheck and build.
- Update README and deployment/development docs to match the current stack.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 23:09:22 -04:00

72 lines
2.2 KiB
Docker

FROM node:22.14.0-bookworm-slim AS frontend
WORKDIR /frontend
COPY raggr-frontend/package.json raggr-frontend/yarn.lock ./
RUN yarn install --frozen-lockfile
# Copy build inputs explicitly: there is no root .dockerignore, and copying the
# whole directory would overwrite locked Linux deps with host node_modules.
COPY raggr-frontend/src ./src
COPY raggr-frontend/public ./public
COPY raggr-frontend/rsbuild.config.ts raggr-frontend/tsconfig.json raggr-frontend/postcss.config.mjs ./
RUN yarn build
FROM ghcr.io/astral-sh/uv:0.7.2 AS uv
FROM python:3.13.2-slim-bookworm
WORKDIR /app
# Node is required by the optional stdio MCP and Obsidian tools at runtime.
COPY --from=frontend /usr/local/bin/node /usr/local/bin/node
COPY --from=frontend /usr/local/lib/node_modules /usr/local/lib/node_modules
RUN ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
COPY --from=uv /uv /uvx /usr/local/bin/
RUN apt-get update && apt-get install -y \
build-essential \
curl \
&& npm install -g obsidian-headless@0.0.8 @googleworkspace/cli@0.8.0 \
&& rm -rf /var/lib/apt/lists/*
# Add uv to PATH
ENV PATH="/root/.local/bin:$PATH"
# Homebox MCP server (stdio), pinned so the tool surface can't drift
RUN uv tool install homebox-mcp==1.1.0
# BookStack MCP server (stdio), pinned for the same reason
RUN npm install -g bookstack-mcp@5.6.0
# Copy dependency files
COPY pyproject.toml uv.lock ./
# Install Python dependencies using uv
# Export the frozen graph and install it system-wide: python and aerich remain
# available to startup.sh and docker compose exec without activating a venv.
RUN uv lock --check \
&& uv export --frozen --no-dev --no-emit-project --quiet -o /tmp/requirements.txt \
&& uv pip install --system --require-hashes -r /tmp/requirements.txt \
&& rm /tmp/requirements.txt
# Copy application code
COPY *.py ./
COPY blueprints ./blueprints
COPY migrations ./migrations
COPY utils ./utils
COPY config ./config
COPY scripts ./scripts
COPY startup.sh ./
RUN chmod +x startup.sh
COPY --from=frontend /frontend/dist ./raggr-frontend/dist
# Create database directory
RUN mkdir -p /app/database /app/checkpoints
# Expose port
EXPOSE 8080
# Set environment variables
ENV PYTHONPATH=/app
# Run the startup script
CMD ["./startup.sh"]