- 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
40748347ac
commit
5a17a89290
@ -52,10 +52,11 @@ volumes:
|
|||||||
The image uses environment variables to figure out how you want it to run.
|
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.
|
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.
|
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" 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" pulls from https://get.5e.tools
|
||||||
> "GET5ETOOLS-NOIMG" pulls from https://get.5e.tools without image files.
|
> "GET5ETOOLS-NOIMG" pulls from https://get.5e.tools without image files.
|
||||||
|
|
||||||
|
|||||||
@ -8,10 +8,11 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- 8080:80/tcp
|
- 8080:80/tcp
|
||||||
environment:
|
environment:
|
||||||
- SOURCE=GITHUB
|
- SOURCE=GITHUB-NOIMG
|
||||||
# Required unless OFFLINE_MODE=TRUE
|
# 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 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 pulls from https://get.5e.tools
|
||||||
# GET5ETOOLS-NOIMG pulls from https://get.5e.tools without image files.
|
# 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.
|
# The get.5e.tools source has been down (redirecting to 5e.tools) during development.
|
||||||
|
|||||||
30
init.sh
30
init.sh
@ -13,7 +13,7 @@ fi
|
|||||||
# If local version is found, print version and start server.
|
# If local version is found, print version and start server.
|
||||||
# If no local version is found, print error message and exit.
|
# If no local version is found, print error message and exit.
|
||||||
if [ "$OFFLINE_MODE" = "TRUE" ]; then
|
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
|
if [ -f /usr/local/apache2/htdocs/package.json ]; then
|
||||||
VERSION=$(jq -r .version package.json) # Get version from package.json
|
VERSION=$(jq -r .version package.json) # Get version from package.json
|
||||||
echo " === Starting version $VERSION"
|
echo " === Starting version $VERSION"
|
||||||
@ -26,7 +26,7 @@ fi
|
|||||||
|
|
||||||
# The SOURCE variable must be set if OFFLINE_MODE is not TRUE
|
# The SOURCE variable must be set if OFFLINE_MODE is not TRUE
|
||||||
if [ -z "${SOURCE}" ]; then
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -38,24 +38,34 @@ ls -ld /usr/local/apache2/htdocs
|
|||||||
|
|
||||||
SOURCE=${SOURCE}
|
SOURCE=${SOURCE}
|
||||||
case $SOURCE in
|
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
|
DL_LINK=https://github.com/5etools-mirror-1/5etools-mirror-1.github.io.git
|
||||||
echo " === Using GitHub structure to update from $DL_LINK"
|
echo " === Using GitHub mirror at $DL_LINK"
|
||||||
echo " === Warning: images will be downloaded automatically, which will take longer"
|
|
||||||
if [ ! -d "./.git" ]; then # if no git repository already exists
|
if [ ! -d "./.git" ]; then # if no git repository already exists
|
||||||
echo " === No existing git repository, creating one"
|
echo " === No existing git repository, creating one"
|
||||||
git config --global user.email "autodeploy@jafner.tools"
|
git config --global user.email "autodeploy@jafner.tools"
|
||||||
git config --global user.name "AutoDeploy"
|
git config --global user.name "AutoDeploy"
|
||||||
git config --global pull.rebase false # Squelch nag message
|
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
|
fi
|
||||||
echo " === Pulling from GitHub... (This might take a while)"
|
if [[ "$SOURCE" == *"NOIMG"* ]]; then # if user does not want images
|
||||||
git pull --depth=1 origin master #2> /dev/null
|
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
|
VERSION=$(jq -r .version package.json) # Get version from package.json
|
||||||
echo " === Starting version $VERSION"
|
echo " === Starting version $VERSION"
|
||||||
httpd-foreground
|
httpd-foreground
|
||||||
;;
|
;;
|
||||||
"GET5ETOOLS*")
|
|
||||||
|
"GET5ETOOLS" | "GET5ETOOLS-NOIMG")
|
||||||
DL_LINK=https://get.5e.tools
|
DL_LINK=https://get.5e.tools
|
||||||
echo " === Using get structure to download from $DL_LINK"
|
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."
|
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"
|
echo " === Starting version $VERSION"
|
||||||
httpd-foreground
|
httpd-foreground
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "SOURCE variable set incorrectly. Exiting..."
|
echo "SOURCE variable set incorrectly. Exiting..."
|
||||||
exit
|
exit
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user