Skip to content

Commit

Permalink
Miscellaneous fixes:
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
Jafner committed Sep 6, 2023
1 parent 852d01d commit 689c236
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
11 changes: 6 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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:
7 changes: 6 additions & 1 deletion init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 689c236

Please sign in to comment.