Use build args for git user config

Change git configuration to use Docker build args instead of .env file,
simplifying setup and improving security. This change:
- Removes git config from .env and startup.sh
- Adds GIT_USER_NAME and GIT_USER_EMAIL build args
- Updates documentation for new git config approach
- Improves task logging requirements in CLAUDE.md

The build arg approach provides better isolation and ensures git config is
properly set during image build rather than container runtime.
This commit is contained in:
Vishal Jain
2025-06-18 14:19:18 +01:00
parent 5377ac9b64
commit 9baf9f5c4b
6 changed files with 40 additions and 32 deletions

View File

@@ -82,16 +82,18 @@ RUN bash -c 'source /app/.env && \
echo "No Twilio credentials found, skipping MCP configuration"; \
fi'
# Configure git user during build
RUN bash -c 'source /app/.env && \
if [ -n "$GIT_USER_NAME" ] && [ -n "$GIT_USER_EMAIL" ]; then \
echo "Configuring git user: $GIT_USER_NAME <$GIT_USER_EMAIL>" && \
git config --global user.name "$GIT_USER_NAME" && \
git config --global user.email "$GIT_USER_EMAIL" && \
# Configure git user during build using host git config
RUN bash -c '\
GIT_NAME=$(git config --global --get user.name 2>/dev/null || echo "") && \
GIT_EMAIL=$(git config --global --get user.email 2>/dev/null || echo "") && \
if [ -n "$GIT_NAME" ] && [ -n "$GIT_EMAIL" ]; then \
echo "Configuring git user from host: $GIT_NAME <$GIT_EMAIL>" && \
git config --global user.name "$GIT_NAME" && \
git config --global user.email "$GIT_EMAIL" && \
echo "Git configuration complete"; \
else \
echo "Warning: GIT_USER_NAME and GIT_USER_EMAIL not set in .env"; \
echo "Git commits will require manual configuration"; \
echo "Warning: No git user configured on host system"; \
echo "Run 'git config --global user.name "Your Name"' and 'git config --global user.email "you@example.com"' on host first"; \
fi'
# Set working directory to mounted volume