This directory contains a Docker-based setup for building and serving OpenCue documentation without requiring a local Ruby installation.
- Docker (version 20.10 or later)
- Docker Compose (version 2.0 or later)
Build the documentation once:
cd docs/
docker compose --profile build upThe built site will be available in the _site/ directory.
Start a local development server with live reload:
cd docs/
docker compose --profile serve upThen open http://localhost:4000 in your browser. Changes to documentation files will automatically trigger a rebuild.
For convenience, use the provided helper script:
# Build documentation
./docker-build.sh build
# Serve with live reload
./docker-build.sh serve
# Clean build artifacts
./docker-build.sh clean
# Show help
./docker-build.sh helpThe setup includes three profiles for different use cases:
Builds the documentation once and exits.
docker compose --profile build upUse case: One-time builds, CI/CD pipelines, generating static output
Starts a development server with live reload.
docker compose --profile serve upUse case: Local development, testing changes in real-time
Features:
- Live reload on file changes
- Accessible at http://localhost:4000
- Force polling for file system compatibility
Builds without volume mounts for clean CI/CD environments.
docker compose --profile ci upUse case: Continuous integration, automated builds
# Build the image
docker compose build
# Build with no cache
docker compose build --no-cache# Build documentation (one-time)
docker compose --profile build up
# Serve documentation (development)
docker compose --profile serve up
# Run in detached mode
docker compose --profile serve up -d
# Stop running containers
docker compose down# Execute commands in running container
docker compose exec docs-serve bash
# Run one-off commands
docker compose run --rm docs-build bundle exec jekyll --version# Stop and remove containers
docker compose down
# Remove volumes
docker compose down -v
# Remove images
docker compose down --rmi all
# Clean build output
rm -rf _site .jekyll-cacheThe setup uses Docker volumes to persist Ruby gems and improve build performance:
- docs-bundle: Caches installed Ruby gems
- Source mount: Maps local
docs/directory to/docsin container
- Faster subsequent builds (gems are cached)
- Changes to local files immediately reflected in container
- No need to rebuild image for documentation changes
# Remove bundle cache
docker volume rm docs_docs-bundle
# Rebuild from scratch
docker compose down -v
docker compose build --no-cacheIf port 4000 is already in use:
# Find process using port 4000
lsof -i :4000
# Kill the process
kill -9 <PID>
# Or use a different port
docker compose --profile serve run --rm -p 4001:4000 docs-serveIf you encounter permission issues with generated files:
# Fix ownership of generated files
sudo chown -R $USER:$USER _site .jekyll-cacheIf the build fails:
# Check logs
docker compose logs
# Rebuild without cache
docker compose build --no-cache
# Verify Gemfile.lock
rm Gemfile.lock
docker compose --profile build upIf live reload doesn't work:
- Ensure you're using
--force_pollingflag (already included) - Check browser console for WebSocket errors
- Try clearing browser cache
- Verify port 35729 (LiveReload port) is not blocked
name: Build Documentation
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build documentation with Docker
run: |
cd docs
docker compose --profile ci up --abort-on-container-exit
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: documentation
path: docs/_site/build-docs:
image: docker:latest
services:
- docker:dind
script:
- cd docs
- docker compose --profile ci up --abort-on-container-exit
artifacts:
paths:
- docs/_site/Run custom Jekyll commands:
# Check Jekyll version
docker compose run --rm docs-build bundle exec jekyll --version
# Build with specific config
docker compose run --rm docs-build bundle exec jekyll build --config _config.yml,_config_dev.yml
# Run with drafts
docker compose run --rm docs-build bundle exec jekyll serve --drafts --host 0.0.0.0Enable verbose output:
# Verbose build
docker compose run --rm docs-build bundle exec jekyll build --verbose --trace
# Check bundle environment
docker compose run --rm docs-build bundle envFor production deployments, consider using a multi-stage Dockerfile:
# Build stage
FROM ruby:3.2-alpine AS builder
WORKDIR /docs
COPY Gemfile* ./
RUN bundle install
COPY . .
RUN bundle exec jekyll build
# Serve stage
FROM nginx:alpine
COPY --from=builder /docs/_site /usr/share/nginx/html- Use volume caching: The setup already uses volumes for gem caching
- Incremental builds: Use
--incrementalflag for faster rebuilds - Limit file watching: Exclude unnecessary directories in
_config.yml - Use BuildKit: Enable Docker BuildKit for faster builds:
export DOCKER_BUILDKIT=1
| Feature | Docker Setup | Local Setup |
|---|---|---|
| Ruby installation | Not required | Required (3.0+) |
| Dependency management | Containerized | System-wide |
| Consistency | Guaranteed | Varies by system |
| Setup time | Fast (pull image) | Slower (install deps) |
| Isolation | Complete | Limited |
| Performance | Slight overhead | Native speed |
For issues or questions:
- GitHub Issues: https://github.com/AcademySoftwareFoundation/OpenCue/issues
- Slack: #opencue on ASWF Slack
- Documentation: https://docs.opencue.io
Dockerfile- Docker image definitiondocker-compose.yml- Docker Compose configurationdocker-build.sh- Helper script for common tasksGemfile- Ruby dependencies_config.yml- Jekyll configuration