From bced65a8578dbbb924a7f7293bfdcc8f9ceea19d Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Tue, 10 Feb 2026 19:50:19 +0800 Subject: [PATCH] improve build script and instruction --- .dev/build-docs.sh | 2 +- .dev/run-in-container.sh | 13 +++++++------ README.md | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) mode change 100644 => 100755 .dev/build-docs.sh mode change 100644 => 100755 .dev/run-in-container.sh diff --git a/.dev/build-docs.sh b/.dev/build-docs.sh old mode 100644 new mode 100755 index c4297b4177..ad669e14a7 --- a/.dev/build-docs.sh +++ b/.dev/build-docs.sh @@ -21,4 +21,4 @@ docker run \ --mount type=bind,source="$PWD",target="/spark-website" \ -w /spark-website \ docs-builder:latest \ - /bin/bash -c "sh .dev/run-in-container.sh" + /bin/bash -c ".dev/run-in-container.sh" diff --git a/.dev/run-in-container.sh b/.dev/run-in-container.sh old mode 100644 new mode 100755 index 1ba306d629..c68e672601 --- a/.dev/run-in-container.sh +++ b/.dev/run-in-container.sh @@ -16,20 +16,21 @@ # # 1.Set env variable. -export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64 -export PATH=$JAVA_HOME/bin:$PATH +export JAVA_HOME="/usr/lib/jvm/$(ls /usr/lib/jvm/ | grep java-17-openjdk | awk '{print $NF}')" +export PATH="$JAVA_HOME/bin:$PATH" # 2.Install bundler. gem install bundler -v 2.4.22 bundle install -# 3. Create a user matching the host UID/GID -groupadd -g $HOST_GID docuser -useradd -u $HOST_UID -g $HOST_GID -m docuser +# 3. Create a user matching the host UID/GID, if it doesn't exist +groupadd -g $HOST_GID docuser || true +useradd -u $HOST_UID -g $HOST_GID -m docuser || true +DOC_USER=$(getent passwd "$HOST_UID" | cut -d: -f1) # We need this link to make sure `python3` points to `python3.11` which contains the prerequisite packages. ln -s "$(which python3.11)" "/usr/local/bin/python3" # Build docs rm -rf .jekyll-cache -su docuser -c "bundle exec jekyll build" +su "$DOC_USER" -c "bundle exec jekyll build" diff --git a/README.md b/README.md index 2e3e003dc6..bef477a201 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ docker build \ Once the image is built, navigate to the `spark-website` root directory, run the script which processes the Markdown files in the Docker container. ``` -SPARK_WEBSITE_PATH="/path/to/spark-website" sh .dev/build-docs.sh +.dev/build-docs.sh ``` ## Docs sub-dir