- Add support for GITHUB-NOIMG via sparse-checkout
- Switch to GITHUB-NOIMG as default - Document support for GITHUB-NOIMG
This commit is contained in:
parent
2be73c2f6e
commit
8e22bd5e44
@ -52,14 +52,15 @@ volumes:
|
||||
The image uses environment variables to figure out how you want it to run.
|
||||
By default, I assume you want to automatically download the latest files from the Github mirror. Use the environment variables in the `docker-compose.yml` file to configure things.
|
||||
|
||||
### SOURCE (defaults to GITHUB)
|
||||
### SOURCE (defaults to GITHUB-NOIMG)
|
||||
Required unless OFFLINE_MODE=TRUE.
|
||||
Expects one of "GITHUB", "GET5ETOOLS", or "GET5ETOOLS-NOIMG". Where:
|
||||
> "GITHUB" pulls from https://github.com/5etools-mirror-1/5etools-mirror-1
|
||||
Expects one of "GITHUB", "GITHUB-NOIMG", "GET5ETOOLS", or "GET5ETOOLS-NOIMG". Where:
|
||||
> "GITHUB" pulls from https://github.com/5etools-mirror-1/5etools-mirror-1
|
||||
> "GITHUB-NOIMG" pulls from https://github.com/5etools-mirror-1/5etools-mirror-1 without image files.
|
||||
> "GET5ETOOLS" pulls from https://get.5e.tools
|
||||
> "GET5ETOOLS-NOIMG" pulls from https://get.5e.tools without image files.
|
||||
|
||||
The get.5e.tools source has been down (redirecting to 5e.tools) during development. This method is not tested.
|
||||
The get.5e.tools source has been down (redirecting to 5e.tools) during development. This method is not tested.
|
||||
|
||||
**Note: As of December 2022, get.5e.tools has been down for several months**. The URL redirects to the main 5etools page, but does not provide packaged archives of the site like it used to. I will update this if or when the original get.5e.tools returns.
|
||||
|
||||
|
@ -8,10 +8,11 @@ services:
|
||||
ports:
|
||||
- 8080:80/tcp
|
||||
environment:
|
||||
- SOURCE=GITHUB
|
||||
- SOURCE=GITHUB-NOIMG
|
||||
# Required unless OFFLINE_MODE=TRUE
|
||||
# Expects one of "GITHUB", "GET5ETOOLS", or "GET5ETOOLS-NOIMG". Where:
|
||||
# Expects one of "GITHUB", "GITHUB-NOIMG", "GET5ETOOLS", or "GET5ETOOLS-NOIMG". Where:
|
||||
# GITHUB pulls from https://github.com/5etools-mirror-1/5etools-mirror-1
|
||||
# GITHUB-NOIMG pulls from https://github.com/5etools-mirror-1/5etools-mirror-1 without image files.
|
||||
# GET5ETOOLS pulls from https://get.5e.tools
|
||||
# GET5ETOOLS-NOIMG pulls from https://get.5e.tools without image files.
|
||||
# The get.5e.tools source has been down (redirecting to 5e.tools) during development.
|
||||
|
@ -13,7 +13,7 @@ fi
|
||||
# If local version is found, print version and start server.
|
||||
# If no local version is found, print error message and exit.
|
||||
if [ "$OFFLINE_MODE" = "TRUE" ]; then
|
||||
echo "Offline mode is enabled. Will try to launch from local files. Checking for local version..."
|
||||
echo " === Offline mode is enabled. Will try to launch from local files. Checking for local version..."
|
||||
if [ -f /usr/local/apache2/htdocs/package.json ]; then
|
||||
VERSION=$(jq -r .version package.json) # Get version from package.json
|
||||
echo " === Starting version $VERSION"
|
||||
@ -26,7 +26,7 @@ fi
|
||||
|
||||
# The SOURCE variable must be set if OFFLINE_MODE is not TRUE
|
||||
if [ -z "${SOURCE}" ]; then
|
||||
echo "SOURCE variable not set. Expects one of \"GITHUB\", \"GET5ETOOLS\", or \"GET5ETOOLS-NOIMG\". Exiting."
|
||||
echo " === SOURCE variable not set. Expects one of \"GITHUB\", \"GET5ETOOLS\", or \"GET5ETOOLS-NOIMG\". Exiting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -38,24 +38,34 @@ ls -ld /usr/local/apache2/htdocs
|
||||
|
||||
SOURCE=${SOURCE}
|
||||
case $SOURCE in
|
||||
"GITHUB")
|
||||
"GITHUB" | "GITHUB-NOIMG") # Source is the github mirror
|
||||
DL_LINK=https://github.com/5etools-mirror-1/5etools-mirror-1.github.io.git
|
||||
echo " === Using GitHub structure to update from $DL_LINK"
|
||||
echo " === Warning: images will be downloaded automatically, which will take longer"
|
||||
echo " === Using GitHub mirror at $DL_LINK"
|
||||
if [ ! -d "./.git" ]; then # if no git repository already exists
|
||||
echo " === No existing git repository, creating one"
|
||||
git config --global user.email "autodeploy@jafner.tools"
|
||||
git config --global user.name "AutoDeploy"
|
||||
git config --global pull.rebase false # Squelch nag message
|
||||
git clone --depth=1 $DL_LINK .
|
||||
git clone --filter=blob:none --no-checkout $DL_LINK . # clone the repo with no files and no object history
|
||||
git config core.sparseCheckout true # enable sparse checkout
|
||||
git sparse-checkout init
|
||||
else
|
||||
echo " === Using existing git repository"
|
||||
fi
|
||||
echo " === Pulling from GitHub... (This might take a while)"
|
||||
git pull --depth=1 origin master #2> /dev/null
|
||||
if [[ "$SOURCE" == *"NOIMG"* ]]; then # if user does not want images
|
||||
echo -e '/*\n!img' > .git/info/sparse-checkout # sparse checkout should include everything except the img directory
|
||||
echo " === Pulling from GitHub without images..."
|
||||
else
|
||||
echo -e '/*' > .git/info/sparse-checkout # sparse checkout should include everything
|
||||
echo " === Pulling from GitHub with images... (This will take a while)"
|
||||
fi
|
||||
git checkout
|
||||
VERSION=$(jq -r .version package.json) # Get version from package.json
|
||||
echo " === Starting version $VERSION"
|
||||
httpd-foreground
|
||||
;;
|
||||
"GET5ETOOLS*")
|
||||
|
||||
"GET5ETOOLS" | "GET5ETOOLS-NOIMG")
|
||||
DL_LINK=https://get.5e.tools
|
||||
echo " === Using get structure to download from $DL_LINK"
|
||||
echo " === WARNING: This part of the script has not yet been tested. Please open an issue on the github if you have trouble."
|
||||
@ -106,6 +116,8 @@ case $SOURCE in
|
||||
echo " === Starting version $VERSION"
|
||||
httpd-foreground
|
||||
;;
|
||||
|
||||
|
||||
*)
|
||||
echo "SOURCE variable set incorrectly. Exiting..."
|
||||
exit
|
||||
|
Loading…
Reference in New Issue
Block a user