Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docker-compose.yml
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:
Comment thread
Jefffrey marked this conversation as resolved.
docs:
build:
context: .
dockerfile: docs/Dockerfile
volumes:
- .:/work
working_dir: /work/docs
74 changes: 74 additions & 0 deletions docs/Dockerfile
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; \
Comment thread
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
Comment thread
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
Comment thread
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"]
20 changes: 20 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,31 @@ https://datafusion.apache.org/ as part of the release process.

## Dependencies

### Option 1: Docker (Recommended)

If you have Docker installed, you can build the docs without installing any dependencies on your system:

```sh
# Using docker-compose (simplest) (POSIX shells: bash, zsh, etc.)
docker-compose run --rm docs bash build.sh

# Or using docker directly (POSIX shells: bash, zsh, etc.)
docker build -t datafusion-docs -f docs/Dockerfile .
docker run --rm -v $(pwd):/work datafusion-docs bash build.sh
# On Windows PowerShell, use:
# docker run --rm -v ${PWD}:/work datafusion-docs bash build.sh
```
Comment thread
Jefffrey marked this conversation as resolved.

The built documentation will be available in `docs/build/html/`.

### Option 2: Local Installation

It's recommended to install build dependencies and build the documentation
inside a Python virtualenv.

```sh
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
```

Expand Down
30 changes: 30 additions & 0 deletions docs/entrypoint.sh
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"' _ {} \;
Comment thread
Jefffrey marked this conversation as resolved.
Outdated
fi

# Build documentation
cd /work/docs
bash build.sh