Skip to content

Commit b6633a3

Browse files
authored
docs: add Docker setup for building documentation (#2130)
Add comprehensive Docker-based setup for building OpenCue documentation without requiring local Ruby installation. This provides multiple interfaces (helper script, Make, Docker Compose, direct Docker) to accommodate different workflows and ensures consistent build environments across all platforms. Changes: - Add Dockerfile with Ruby 3.2 Alpine base image - Add docker-compose.yml with build, serve, and ci profiles - Add docker-build.sh helper script with fallback support - Add Makefile for Make-based Docker commands - Add .dockerignore for optimized builds - Add DOCKER.md with comprehensive documentation - Add DOCKER_SETUP_SUMMARY.md for implementation details - Update README.md to recommend Docker setup as Option 1 Features: - No Ruby installation required - Live reload development server - Persistent gem caching for faster builds - CI/CD ready with clean build profile - Backward compatible with local Ruby setup - Supports Docker Compose v1, v2, or direct Docker commands Issue Number: close #1869 --------- Signed-off-by: Madduri, Pavan <[email protected]> Signed-off-by: pmady <[email protected]>
1 parent 8b39636 commit b6633a3

File tree

8 files changed

+818
-17
lines changed

8 files changed

+818
-17
lines changed

.github/workflows/docs-pipeline.yml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,8 @@ jobs:
5555
VERSION_TAG=${GITHUB_REF#refs/tags/}
5656
git checkout tags/$VERSION_TAG -b docs-$VERSION_TAG
5757
58-
- name: Setup Ruby
59-
uses: ruby/setup-ruby@v1
60-
with:
61-
ruby-version: '3.2'
62-
bundler-cache: true
63-
working-directory: ./docs
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v3
6460

6561
- name: Extract version information
6662
id: version
@@ -107,7 +103,12 @@ jobs:
107103
git_hash: "$(git rev-parse --short HEAD)"
108104
EOF
109105
110-
- name: Build with Jekyll
106+
- name: Build Docker image
107+
working-directory: ./docs
108+
run: |
109+
docker build -t opencue-docs:ci .
110+
111+
- name: Build with Jekyll using Docker
111112
working-directory: ./docs
112113
run: |
113114
# Set version in config
@@ -122,24 +123,28 @@ jobs:
122123
echo "opencue_version: ${{ steps.version.outputs.opencue_version }}" >> _config.yml
123124
124125
# Determine baseurl based on deployment target
125-
# For docs.opencue.io deployment, use empty baseurl
126-
# For GitHub Pages in forks, use /OpenCue
126+
BASEURL=""
127127
if [ "${{ github.repository }}" = "AcademySoftwareFoundation/OpenCue" ]; then
128128
# Main repository - deploying to docs.opencue.io
129-
bundle exec jekyll build --baseurl ""
129+
BASEURL=""
130130
elif [ "${{ github.event_name }}" = "pull_request" ]; then
131131
# Pull request - use GitHub Pages path
132-
bundle exec jekyll build --baseurl "/OpenCue"
132+
BASEURL="/OpenCue"
133133
else
134134
# Fork or other deployment - use GitHub Pages path
135135
if [ "${{ steps.version.outputs.version }}" != "main" ]; then
136-
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}/${{ steps.version.outputs.version }}"
136+
BASEURL="${{ steps.pages.outputs.base_path }}/${{ steps.version.outputs.version }}"
137137
else
138-
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
138+
BASEURL="${{ steps.pages.outputs.base_path }}"
139139
fi
140140
fi
141-
env:
142-
JEKYLL_ENV: production
141+
142+
# Build documentation using Docker
143+
docker run --rm \
144+
-v "$(pwd):/docs" \
145+
-e JEKYLL_ENV=production \
146+
opencue-docs:ci \
147+
bundle exec jekyll build --baseurl "$BASEURL" --verbose
143148
144149
- name: Create version redirect
145150
if: github.event_name != 'pull_request'

docs/.dockerignore

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Docker ignore file for OpenCue documentation builds
2+
# Excludes unnecessary files from Docker build context
3+
4+
# Build output
5+
_site/
6+
.jekyll-cache/
7+
.sass-cache/
8+
9+
# Git
10+
.git/
11+
.gitignore
12+
13+
# IDE and editor files
14+
.vscode/
15+
.idea/
16+
*.swp
17+
*.swo
18+
*~
19+
.DS_Store
20+
21+
# Documentation metadata
22+
nav_order_index.txt
23+
24+
# Docker files (not needed in container)
25+
.dockerignore
26+
docker-compose.yml
27+
28+
# Temporary files
29+
*.tmp
30+
*.log

0 commit comments

Comments
 (0)