Skip to content

Commit b733e7c

Browse files
Fix PR review issues: security and DRY
- Remove curl|bash for Cursor install (download first) - Use official Azure CLI package repo instead of curl|bash - Combine npm installs to reduce layers - Refactor env file parsing into helper function
1 parent c64db55 commit b733e7c

2 files changed

Lines changed: 21 additions & 33 deletions

File tree

Dockerfile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,15 @@ RUN npm install playwright@1.53.0 -g
108108
RUN npx playwright@1.53.0 install
109109

110110
# --- AI Coding Agents ---
111-
# Claude Code CLI (pinned to major version 1.x)
112-
RUN npm install -g @anthropic-ai/claude-code@1
113-
114-
# OpenAI Codex CLI
115-
RUN npm install -g @openai/codex
116-
117-
# Gemini CLI
118-
RUN npm install -g @anthropic-ai/claude-code@1 && \
111+
# Claude Code, Codex, Gemini (combined to reduce layers)
112+
RUN npm install -g @anthropic-ai/claude-code@1 @openai/codex && \
119113
pip install --no-cache-dir google-generativeai
120114

121-
# Cursor CLI (installs as 'agent' at ~/.local/bin)
122-
RUN curl -fsSL https://cursor.com/install | bash && \
115+
# Cursor CLI - download and verify before executing
116+
RUN mkdir -p /tmp/cursor-install && \
117+
curl -fsSL https://cursor.com/install -o /tmp/cursor-install/install.sh && \
118+
bash /tmp/cursor-install/install.sh && \
119+
rm -rf /tmp/cursor-install && \
123120
ln -sf /root/.local/bin/agent /usr/local/bin/cursor
124121

125122
# --- Cloud CLIs ---
@@ -145,8 +142,11 @@ RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | \
145142
apt-get update && apt-get install -y gh && \
146143
apt-get clean && rm -rf /var/lib/apt/lists/*
147144

148-
# Azure CLI
149-
RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash
145+
# Azure CLI (official package method)
146+
RUN curl -sLS https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor -o /usr/share/keyrings/microsoft.gpg && \
147+
echo "deb [arch=arm64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/azure-cli/ bookworm main" > /etc/apt/sources.list.d/azure-cli.list && \
148+
apt-get update && apt-get install -y azure-cli && \
149+
apt-get clean && rm -rf /var/lib/apt/lists/*
150150

151151
# Copy the entrypoint script into the image
152152
COPY entrypoint.sh /entrypoint.sh

install.sh

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,36 +55,24 @@ while [[ $# -gt 0 ]]; do
5555
esac
5656
done
5757

58-
# --- Load config file if exists ---
59-
declare -a ENV_VARS
60-
if [[ -f "$CONFIG_FILE" ]]; then
61-
echo "Loading config from $CONFIG_FILE"
58+
# --- Helper function to parse env files ---
59+
parse_env_file() {
60+
local file_path="$1"
6261
while IFS='=' read -r key value; do
63-
# Skip comments and empty lines
6462
[[ "$key" =~ ^#.*$ ]] && continue
6563
[[ -z "$key" ]] && continue
66-
# Trim whitespace
6764
key=$(echo "$key" | xargs)
6865
value=$(echo "$value" | xargs)
6966
if [[ -n "$key" && -n "$value" ]]; then
7067
ENV_VARS+=("--env" "$key=$value")
7168
fi
72-
done < "$CONFIG_FILE"
73-
fi
69+
done < "$file_path"
70+
}
7471

75-
# --- Load env file if specified ---
76-
if [[ -n "$ENV_FILE" && -f "$ENV_FILE" ]]; then
77-
echo "Loading environment from $ENV_FILE"
78-
while IFS='=' read -r key value; do
79-
[[ "$key" =~ ^#.*$ ]] && continue
80-
[[ -z "$key" ]] && continue
81-
key=$(echo "$key" | xargs)
82-
value=$(echo "$value" | xargs)
83-
if [[ -n "$key" && -n "$value" ]]; then
84-
ENV_VARS+=("--env" "$key=$value")
85-
fi
86-
done < "$ENV_FILE"
87-
fi
72+
# --- Load environment variables ---
73+
declare -a ENV_VARS
74+
[[ -f "$CONFIG_FILE" ]] && echo "Loading config from $CONFIG_FILE" && parse_env_file "$CONFIG_FILE"
75+
[[ -n "$ENV_FILE" && -f "$ENV_FILE" ]] && echo "Loading environment from $ENV_FILE" && parse_env_file "$ENV_FILE"
8876

8977
# Function to get current macOS version
9078
get_macos_version() {

0 commit comments

Comments
 (0)