-
Notifications
You must be signed in to change notification settings - Fork 2.1k
docs: add Docker-based workflow for building documentation #19863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GaneshPatil7517
wants to merge
16
commits into
apache:main
Choose a base branch
from
GaneshPatil7517:docs/dockerized-docs-build
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+94
−0
Open
Changes from 8 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
469a0d8
docs: add Dockerfile for building documentation
GaneshPatil7517 52cabbb
Merge branch 'main' into docs/dockerized-docs-build
GaneshPatil7517 b7adf87
Update docs/Dockerfile
GaneshPatil7517 73c0d58
Update docs/Dockerfile
GaneshPatil7517 f386516
Update docker-compose.yml
GaneshPatil7517 c4a017e
Update docs/README.md
GaneshPatil7517 c9fb69d
Update docs/Dockerfile
GaneshPatil7517 6c04dce
docs: extract build logic to entrypoint.sh for better maintainability
GaneshPatil7517 13bfb7f
refactor: simplify Dockerfile based on review feedback
GaneshPatil7517 4826c82
fix: update Docker commands in README to match simplified Dockerfile
GaneshPatil7517 e7db3d5
refactor: address review feedback
GaneshPatil7517 468a97c
Merge branch 'main' into docs/dockerized-docs-build
GaneshPatil7517 e3aa78b
fix: optimize Docker build caching to prevent re-downloading Rust dep…
GaneshPatil7517 51d2eeb
fix: correct Docker build context and paths for docker-compose compat…
GaneshPatil7517 a727daf
Merge branch 'docs/dockerized-docs-build' of https://github.com/Ganes…
GaneshPatil7517 c980952
Merge branch 'main' into docs/dockerized-docs-build
GaneshPatil7517 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| services: | ||
| docs: | ||
| build: | ||
| context: . | ||
| dockerfile: docs/Dockerfile | ||
| volumes: | ||
| - .:/work | ||
| working_dir: /work/docs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| FROM python:3.11-slim | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
| curl \ | ||
| build-essential \ | ||
| graphviz \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Install Rust 1.92.0 | ||
| ENV RUST_VERSION=1.92.0 | ||
| ENV RUSTUP_VERSION=1.27.1 | ||
| RUN set -eux; \ | ||
|
Jefffrey marked this conversation as resolved.
Outdated
|
||
| arch="$(uname -m)"; \ | ||
| case "${arch}" in \ | ||
| x86_64) rustup_arch="x86_64-unknown-linux-gnu" ;; \ | ||
| aarch64) rustup_arch="aarch64-unknown-linux-gnu" ;; \ | ||
| *) echo "Unsupported architecture: ${arch}" >&2; exit 1 ;; \ | ||
| esac; \ | ||
| curl --proto '=https' --tlsv1.2 -sSf \ | ||
| "https://static.rust-lang.org/rustup/archive/${RUSTUP_VERSION}/${rustup_arch}/rustup-init" \ | ||
| -o rustup-init; \ | ||
| chmod +x rustup-init; \ | ||
| ./rustup-init \ | ||
| --default-toolchain "${RUST_VERSION}" \ | ||
| --component rustfmt \ | ||
| --profile minimal \ | ||
| -y; \ | ||
| rm rustup-init | ||
|
|
||
| ENV PATH="/root/.cargo/bin:${PATH}" | ||
|
|
||
| # Install cargo-depgraph | ||
|
Jefffrey marked this conversation as resolved.
Outdated
|
||
| RUN cargo install cargo-depgraph --version ^1.6 --locked | ||
|
|
||
| # Set working directory | ||
| WORKDIR /work | ||
|
|
||
| # Copy Python requirements and install them | ||
| COPY docs/requirements.txt /work/docs/requirements.txt | ||
| RUN pip install --no-cache-dir -r /work/docs/requirements.txt | ||
|
|
||
| # Copy the entire repository | ||
| COPY . /work | ||
|
Jefffrey marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Copy and set up the entrypoint script | ||
| COPY docs/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
| RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
|
||
| # Fix line endings for shell scripts at build time (convert CRLF to LF) | ||
| RUN find /work -name "*.sh" -type f -exec sh -c 'tr -d "\r" < "$1" > "$1.tmp" && mv "$1.tmp" "$1"' _ {} \; | ||
|
|
||
| # Set working directory to docs for build | ||
| WORKDIR /work/docs | ||
|
|
||
| # Use entrypoint script for better readability and maintainability | ||
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env bash | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Fix line endings when running (for volume-mounted files from Windows) only if needed | ||
| if find /work -name '*.sh' -type f -print0 | xargs -0 grep -Il $'\r' >/dev/null 2>&1; then | ||
| echo "Converting CRLF to LF in shell scripts..." | ||
| find /work -name '*.sh' -type f -exec sh -c 'tr -d "\r" < "$1" > "$1.tmp" && mv "$1.tmp" "$1"' _ {} \; | ||
|
Jefffrey marked this conversation as resolved.
Outdated
|
||
| fi | ||
|
|
||
| # Build documentation | ||
| cd /work/docs | ||
| bash build.sh | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.