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.
This commit is contained in:
Joey Hafner 2023-09-05 17:13:04 -07:00
parent 6e2c65572f
commit d24b76cd48
2 changed files with 12 additions and 6 deletions

View File

@ -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:
# Uncomment this block to use a docker-managed volume:
#volumes:
# 5etools-docker:

View File

@ -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