Fix updating from Git on launch

This commit is contained in:
Joey Hafner 2022-12-22 09:22:43 -08:00
parent 3bc3701677
commit 89f8c08d08
2 changed files with 7 additions and 4 deletions

View File

@ -2,7 +2,7 @@ version: "3"
services:
5etools-docker:
container_name: 5etools-docker
image: jafner/5etools-docker
image: 5etools-docker:dev # jafner/5etools-docker
volumes:
- 5etools-docker:/usr/local/apache2/htdocs
ports:
@ -10,7 +10,7 @@ services:
environment:
- SOURCE=GITHUB-NOIMG
# Required unless OFFLINE_MODE=TRUE
# Expects one of "GITHUB", "GITHUB-NOIMG", "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

View File

@ -37,8 +37,9 @@ echo " === Checking directory permissions for /usr/local/apache2/htdocs"
ls -ld /usr/local/apache2/htdocs
SOURCE=${SOURCE}
echo "SOURCE=$SOURCE"
case $SOURCE in
"GITHUB" | "GITHUB-NOIMG") # Source is the github mirror
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 mirror at $DL_LINK"
if [ ! -d "./.git" ]; then # if no git repository already exists
@ -60,12 +61,14 @@ case $SOURCE in
echo " === Pulling from GitHub with images... (This will take a while)"
fi
git checkout
git fetch
git pull
VERSION=$(jq -r .version package.json) # Get version from package.json
echo " === Starting version $VERSION"
httpd-foreground
;;
"GET5ETOOLS" | "GET5ETOOLS-NOIMG")
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."