Skip to content

Commit

Permalink
fix(run): Share Git config dir only if it exists
Browse files Browse the repository at this point in the history
Avoid it being created when not exists
  • Loading branch information
leocavalcante authored Mar 22, 2024
1 parent 8f1e198 commit f2cd8b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ run() {
composer_home="-v $composer_home:$composer_home"
fi

local gitconfig=""
if [ -f ~/.gitconfig ]; then
gitconfig="-v ~/.gitconfig:/root/.gitconfig:ro"
fi

if [ -n "$GIT_EXEC_PATH" ]; then
# In a Git hook environment, we need to disable TTY allocation
PHPCTL_TTY="--label=no-tty"
Expand All @@ -68,7 +73,7 @@ run() {
--user "$PHPCTL_USER" \
$(env | awk -F= '/^[[:alpha:]]/{print $1}' | sed 's/^/-e/') \
-v /var/run/docker.sock:/var/run/docker.sock \
-v ~/.gitconfig:/root/.gitconfig:ro \
$gitconfig \
-v "$(pwd)":/usr/local/src -w /usr/local/src \
-v "$PHPCTL_DIR/php.ini:/etc/php$PHP_VERSION/conf.d/zphp.ini" \
$phpctl_ini \
Expand Down

0 comments on commit f2cd8b3

Please sign in to comment.