Skip to content

Documentation Deployment Guide

This guide covers various methods for deploying the BitonicAI documentation.

Docker Deployment

Building Documentation with Docker

The documentation can be built and served using Docker:

# Build the documentation image
docker build -f apps/docs/Dockerfile.docs -t bitonicai-docs .

# Run the container locally
docker run -p 8080:80 bitonicai-docs

Visit http://localhost:8080 to view the documentation.

Docker Build Process

The Dockerfile.docs uses a multi-stage build:

  1. Builder stage: Installs dependencies and builds the static site
  2. Production stage: Uses nginx to serve the built documentation

Customizing the Docker Build

To customize the build:

  1. Modify Dockerfile.docs to add additional dependencies
  2. Add custom nginx configuration if needed
  3. Adjust build arguments as necessary

GitHub Pages Deployment

Prerequisites

  • GitHub repository with documentation source
  • Dependencies installed via uv (no pip):
    uv sync --package docs
    

The repository includes a GitHub Actions workflow (.github/workflows/docs.yml) that automatically deploys documentation.

Setup:

  1. Enable GitHub Pages:
  2. Go to repository Settings → Pages
  3. Under "Source", select "Deploy from a branch"
  4. Select gh-pages branch and / (root) folder
  5. Click Save

  6. Push changes:

    git add .
    git commit -m "Update documentation"
    git push origin main
    

  7. The workflow will automatically:

  8. Build the documentation
  9. Deploy to the gh-pages branch
  10. Make it available at https://<username>.github.io/<repository-name>/

Workflow triggers: - Pushes to main branch - Changes to docs/, mkdocs.yml, or source code - Manual trigger via workflow_dispatch

Method 2: Manual Deployment with mkdocs gh-deploy

# Deploy to GitHub Pages
uv run --project apps/docs mkdocs gh-deploy

This command: 1. Builds the documentation 2. Creates/updates the gh-pages branch 3. Pushes to GitHub

Method 3: Manual Git Deployment

For more control over the deployment process:

# Build the site
uv run --project apps/docs mkdocs build

# Create or checkout gh-pages branch
git checkout --orphan gh-pages
git rm -rf .

# Copy built site
cp -r site/* .

# Commit and push
git add .
git commit -m "Deploy documentation"
git push origin gh-pages --force

# Return to main branch
git checkout main

Custom Domain

To use a custom domain (e.g., docs.bitonicai.com):

  1. Add a CNAME file to docs/ directory:

    docs.bitonicai.com
    

  2. Update mkdocs.yml:

    site_url: https://docs.bitonicai.com
    

  3. Configure DNS:

  4. Add a CNAME record pointing to <username>.github.io
  5. Or add A records for GitHub Pages IPs

  6. In GitHub repository Settings → Pages, add your custom domain

Other Deployment Options

Netlify

  1. Connect your repository to Netlify
  2. Configure build settings:
  3. Build command: uv sync --package docs && uv run --project apps/docs mkdocs build
  4. Publish directory: apps/docs/site
  5. Deploy

Vercel

  1. Create vercel.json:
    {
      "buildCommand": "uv sync --package docs && uv run --project apps/docs mkdocs build",
      "outputDirectory": "apps/docs/site"
    }
    
  2. Connect repository and deploy

Read the Docs

  1. Create .readthedocs.yml:
    version: 2
    build:
      os: ubuntu-22.04
      tools:
        python: "3.12"
    python:
      install:
        - path: apps/docs
    
  2. Connect repository to Read the Docs
  3. Configure and build

Custom Server

  1. Build the site:
    uv run --project apps/docs mkdocs build
    
  2. Upload the apps/docs/site/ contents to your web server
  3. Configure your web server to serve the static files

Troubleshooting

GitHub Pages Not Updating

  • Check GitHub Actions workflow status
  • Verify gh-pages branch exists and has content
  • Ensure GitHub Pages is enabled in repository settings
  • Check for build errors in Actions logs

Docker Build Fails

  • Verify all required files are present (mkdocs.yml, docs/)
  • Check that source code paths are correct
  • Ensure Python dependencies install successfully

Documentation Not Rendering

  • Verify mkdocs.yml syntax is correct
  • Check that docstring paths in API reference pages are valid
  • Ensure all dependencies are installed
  • Run uv run --project apps/docs mkdocs build --strict to catch errors

Best Practices

  1. Test locally before deploying:

    mkdocs serve
    

  2. Use version control for documentation changes

  3. Automate deployment with GitHub Actions

  4. Monitor build status in GitHub Actions

  5. Keep dependencies updated in apps/docs/pyproject.toml

  6. Document deployment process for team members