Skip to content

Commit 3def12e

Browse files
authored
improve build script and instruction (#675)
1 parent b65957b commit 3def12e

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

.dev/build-docs.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ docker run \
2121
--mount type=bind,source="$PWD",target="/spark-website" \
2222
-w /spark-website \
2323
docs-builder:latest \
24-
/bin/bash -c "sh .dev/run-in-container.sh"
24+
/bin/bash -c ".dev/run-in-container.sh"

.dev/run-in-container.sh

100644100755
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@
1616
#
1717

1818
# 1.Set env variable.
19-
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-arm64
20-
export PATH=$JAVA_HOME/bin:$PATH
19+
export JAVA_HOME="/usr/lib/jvm/$(ls /usr/lib/jvm/ | grep java-17-openjdk | awk '{print $NF}')"
20+
export PATH="$JAVA_HOME/bin:$PATH"
2121

2222
# 2.Install bundler.
2323
gem install bundler -v 2.4.22
2424
bundle install
2525

26-
# 3. Create a user matching the host UID/GID
27-
groupadd -g $HOST_GID docuser
28-
useradd -u $HOST_UID -g $HOST_GID -m docuser
26+
# 3. Create a user matching the host UID/GID, if it doesn't exist
27+
groupadd -g $HOST_GID docuser || true
28+
useradd -u $HOST_UID -g $HOST_GID -m docuser || true
29+
DOC_USER=$(getent passwd "$HOST_UID" | cut -d: -f1)
2930

3031
# We need this link to make sure `python3` points to `python3.11` which contains the prerequisite packages.
3132
ln -s "$(which python3.11)" "/usr/local/bin/python3"
3233

3334
# Build docs
3435
rm -rf .jekyll-cache
35-
su docuser -c "bundle exec jekyll build"
36+
su "$DOC_USER" -c "bundle exec jekyll build"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ docker build \
1818
Once the image is built, navigate to the `spark-website` root directory, run the script which processes
1919
the Markdown files in the Docker container.
2020
```
21-
SPARK_WEBSITE_PATH="/path/to/spark-website" sh .dev/build-docs.sh
21+
.dev/build-docs.sh
2222
```
2323

2424
## Docs sub-dir

0 commit comments

Comments
 (0)