Skip to content

Commit 434745e

Browse files
committed
feat(config): support ENV=${VAR} shorthand pass-through; update examples
docs: add Compose-style ENV examples; warn on docker.sock; host-net Linux-only docker: install git-lfs system-wide; avoid sudo during build; move atl as root cli: display no_grpc_proxy in env summaries Signed-off-by: Eric Wang <wrqatw@gmail.com>
1 parent 6bb3e7d commit 434745e

5 files changed

Lines changed: 54 additions & 7 deletions

File tree

.claude-yolo.example

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ VOLUME=~/.gitconfig:/home/claude/.gitconfig:ro
1616
ENV=CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=true
1717
ENV=DISABLE_TELEMETRY=1
1818

19-
# Mount Extra Voulmes for Claude Code References
19+
# Mount Extra Volumes for Claude Code References
2020
# VOLUME=/path/to/some-docs:$(pwd)/references/some-docs:ro
2121
# VOLUME=/path/to/some-script.sh:/home/claude/.local/bin/some-script.sh:ro
2222

2323
# Environment variables from host
24+
# Pass through a host env var by name
25+
# ENV=GH_TOKEN
26+
# Or Compose-style shorthand pass-through of same name
2427
# ENV=${GH_TOKEN}

.claude-yolo.full

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,19 @@ ENV=DEBUG=*
6666
ENV=LOG_LEVEL=debug
6767

6868
# Pass through host environment variables
69+
# Options:
70+
# - ENV=NAME (pass-through by name)
71+
# - ENV=${NAME} (Compose-style shorthand, same name)
72+
# - ENV=TARGET=${SOURCE:-} (rename with default)
73+
ENV=GITHUB_TOKEN
6974
ENV=${GITHUB_TOKEN}
70-
ENV=${NPM_TOKEN}
75+
ENV=DOCKER_HOST
7176
ENV=${DOCKER_HOST}
77+
ENV=DATABASE_URL
7278
ENV=${DATABASE_URL}
79+
ENV=API_KEY
7380
ENV=${API_KEY}
81+
ENV=SECRET_KEY
7482
ENV=${SECRET_KEY}
7583

7684
# Environment variables with defaults
@@ -129,6 +137,7 @@ VOLUME=~/tmp:/home/claude/tmp
129137

130138
# Docker-in-Docker (requires careful consideration)
131139
VOLUME=/var/run/docker.sock:/var/run/docker.sock
140+
# WARNING: Grants container control over host Docker. Use only when required.
132141

133142
# Build and cache directories
134143
VOLUME=~/.cache:/home/claude/.cache
@@ -157,6 +166,6 @@ VOLUME=~/output:/home/claude/output
157166
# - No command substitution except $(pwd)
158167
# - No backticks allowed
159168
# - No path traversal (..) in CONFIG_DIR
160-
# - Variable names must be [A-Z][A-Z0-9_]*
169+
# - Variable names must be [A-Za-z_][A-Za-z0-9_]* (matches parser)
161170
#
162-
# =====================================
171+
# =====================================

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
4040
update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1 && \
4141
locale-gen en_US.UTF-8
4242

43+
# Initialize Git LFS so it's usable for all users
44+
RUN git lfs install --system
45+
4346
# Install language runtimes in parallel-friendly layers
4447
FROM base AS runtimes
4548

@@ -141,8 +144,8 @@ RUN npm config set prefix "$CLAUDE_HOME/.npm-global" && \
141144
npm cache clean --force
142145

143146
# Install Go tools for Atlassian integration (Confluence/Jira/Bitbucket)
144-
RUN go install github.com/lroolle/atlas-cli/cmd/atl@main && \
145-
sudo mv $HOME/go/bin/atl /usr/local/bin/
147+
# Build as claude user; move binary as root later (avoid sudo in build)
148+
RUN go install github.com/lroolle/atlas-cli/cmd/atl@main
146149

147150
RUN git clone --depth=1 https://github.com/ohmyzsh/ohmyzsh "$CLAUDE_HOME/.oh-my-zsh" && \
148151
git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions "$CLAUDE_HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions" && \
@@ -157,6 +160,9 @@ RUN echo 'export ZSH="$HOME/.oh-my-zsh"' > "$CLAUDE_HOME/.zshrc" && \
157160

158161
USER root
159162

163+
# Move atl into PATH as root (after building as claude)
164+
RUN test -f /home/claude/go/bin/atl && mv /home/claude/go/bin/atl /usr/local/bin/atl || true
165+
160166
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
161167

162168
RUN chmod +x /usr/local/bin/docker-entrypoint.sh && \

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ claude.sh --auth-with api-key # Use API key(may have to rerun `/login`)
5959
claude.sh --auth-with bedrock # Use AWS Bedrock
6060
claude.sh --auth-with vertex # Use Google Vertex AI
6161
claude.sh --shell # Open shell in container
62+
claude.sh --host-net # Host networking (Linux only)
6263
claude.sh --help # Show all options
6364
```
6465

@@ -150,6 +151,10 @@ VOLUME=~/.gitconfig:/home/claude/.gitconfig:ro
150151
ENV=NODE_ENV=development
151152
ENV=DEBUG=myapp:*
152153

154+
# Pass through host env (either form works)
155+
ENV=GH_TOKEN
156+
ENV=${GH_TOKEN}
157+
153158
# Claude settings
154159
ANTHROPIC_MODEL=sonnet-4
155160
USE_TRACE=true

claude.sh

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,16 @@ process_env_config() {
397397
eval "$errors_var+=(\"Invalid env name: \$name\")"
398398
fi
399399
else
400-
if validate_env_name "$value" && [ -n "${!value}" ]; then
400+
# Shorthand pass-through: ENV=${VAR} or ENV=$VAR
401+
if [[ "$value" =~ ^\$\{([A-Za-z_][A-Za-z0-9_]*)\}$ ]] || [[ "$value" =~ ^\$([A-Za-z_][A-Za-z0-9_]*)$ ]]; then
402+
local short_var_name
403+
short_var_name="${BASH_REMATCH[1]}"
404+
if [ -n "${!short_var_name}" ]; then
405+
EXTRA_ENV_VARS+=("-e" "$short_var_name=${!short_var_name}")
406+
DOCKER_ONLY_WARNINGS+=("Config environment variable: $short_var_name=${!short_var_name} (ignored in local mode)")
407+
fi
408+
elif validate_env_name "$value" && [ -n "${!value}" ]; then
409+
# Pass-through by name: ENV=VAR
401410
EXTRA_ENV_VARS+=("-e" "$value=${!value}")
402411
DOCKER_ONLY_WARNINGS+=("Config environment variable: $value=${!value} (ignored in local mode)")
403412
fi
@@ -785,6 +794,16 @@ run_claude_local() {
785794
elif [ -n "$GRPC_PROXY" ]; then
786795
ENV_VARS+=" $(format_env_display 'GRPC_PROXY' "$GRPC_PROXY")\n"
787796
fi
797+
if [ -n "$no_grpc_proxy" ]; then
798+
ENV_VARS+=" $(format_env_display 'no_grpc_proxy' "$no_grpc_proxy")\n"
799+
elif [ -n "$NO_GRPC_PROXY" ]; then
800+
ENV_VARS+=" $(format_env_display 'NO_GRPC_PROXY' "$NO_GRPC_PROXY")\n"
801+
fi
802+
if [ -n "$no_grpc_proxy" ]; then
803+
ENV_VARS+=" $(format_env_display 'no_grpc_proxy' "$no_grpc_proxy")\n"
804+
elif [ -n "$NO_GRPC_PROXY" ]; then
805+
ENV_VARS+=" $(format_env_display 'NO_GRPC_PROXY' "$NO_GRPC_PROXY")\n"
806+
fi
788807
if [ -n "$HTTP_PROXY" ]; then
789808
ENV_VARS+=" $(format_env_display 'HTTP_PROXY' "$HTTP_PROXY")\n"
790809
elif [ -n "$http_proxy" ]; then
@@ -1303,6 +1322,11 @@ if [ -n "$grpc_proxy" ]; then
13031322
elif [ -n "$GRPC_PROXY" ]; then
13041323
ENV_VARS+=" $(format_env_display 'GRPC_PROXY' "$GRPC_PROXY")\n"
13051324
fi
1325+
if [ -n "$no_grpc_proxy" ]; then
1326+
ENV_VARS+=" $(format_env_display 'no_grpc_proxy' "$no_grpc_proxy")\n"
1327+
elif [ -n "$NO_GRPC_PROXY" ]; then
1328+
ENV_VARS+=" $(format_env_display 'NO_GRPC_PROXY' "$NO_GRPC_PROXY")\n"
1329+
fi
13061330
if [ -n "$HTTP_PROXY" ]; then
13071331
ENV_VARS+=" $(format_env_display 'HTTP_PROXY' "$HTTP_PROXY")\n"
13081332
elif [ -n "$http_proxy" ]; then

0 commit comments

Comments
 (0)