From d24b76cd48ea49975edabfde39c7615f4cc26fed Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Tue, 5 Sep 2023 17:13:04 -0700 Subject: [PATCH] Miscellaneous fixes: - Fix default volume mapping behavior to match docs. - Switch default source to include images. - Comment out docker-managed volume. - Anonymize configured git user. - Increase postBuffer size to mitigate issue with Git Bash. - Add safe.directory workaround for pre-existing repositories. --- 5etools-docker/docker-compose.yml | 11 ++++++----- 5etools-docker/init.sh | 7 ++++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/5etools-docker/docker-compose.yml b/5etools-docker/docker-compose.yml index 47322ce5..ec458679 100644 --- a/5etools-docker/docker-compose.yml +++ b/5etools-docker/docker-compose.yml @@ -4,12 +4,12 @@ services: container_name: 5etools-docker image: jafner/5etools-docker volumes: - - 5etools-docker:/usr/local/apache2/htdocs + - ~/5etools-docker/htdocs:/usr/local/apache2/htdocs ports: - 8080:80/tcp environment: - - SOURCE=GITHUB-NOIMG - # Required unless OFFLINE_MODE=TRUE + - SOURCE=GITHUB + # Required unless OFFLINE_MODE=TRUE and the site files are already present. # 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. @@ -20,5 +20,6 @@ services: #- OFFLINE_MODE=TRUE # Optional. Expects "TRUE" or "FALSE". -volumes: - 5etools-docker: \ No newline at end of file +# Uncomment this block to use a docker-managed volume: +#volumes: +# 5etools-docker: \ No newline at end of file diff --git a/5etools-docker/init.sh b/5etools-docker/init.sh index b67c388b..a9f38669 100644 --- a/5etools-docker/init.sh +++ b/5etools-docker/init.sh @@ -44,15 +44,20 @@ case $SOURCE in 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.email "autodeploy@localhost" git config --global user.name "AutoDeploy" git config --global pull.rebase false # Squelch nag message + git config --global http.postBuffer 524288000 # Fix buffer issue on Git Bash + git config --global https.postBuffer 524288000 # Fix buffer issue on Git Bash git config --global --add safe.directory '/usr/local/apache2/htdocs' # Disable directory ownership checking, required for mounted volumes 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" + git config http.postBuffer 524288000 # Fix buffer issue on Git Bash + git config https.postBuffer 524288000 # Fix buffer issue on Git Bash + git config --add safe.directory '/usr/local/apache2/htdocs' # Disable directory ownership checking, required for mounted volumes fi 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