roo code patch laravel container
Build and Push Docker Images / build-and-push (push) Successful in 9m18s
Build and Push Docker Images / build-and-push (push) Successful in 9m18s
This commit is contained in:
1 parent
0c8c437316
commit
7c4852dd49
4 files changed
+86
-1
No files matched your search
@@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y \
|
||||
fish \
|
||||
cron \
|
||||
sudo \
|
||||
ripgrep \
|
||||
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
|
||||
&& docker-php-ext-install gd mbstring zip pdo pdo_mysql pdo_pgsql pgsql intl bcmath pcntl sockets
|
||||
|
||||
@@ -66,6 +67,10 @@ RUN mkdir -p /root/.ssh
|
||||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
||||
RUN chmod +x /usr/local/bin/entrypoint.sh
|
||||
|
||||
# Patch script: make Roo Code use the system ripgrep (fixes "Could not find ripgrep binary")
|
||||
COPY patch-roo-code.sh /usr/local/bin/patch-roo-code.sh
|
||||
RUN chmod +x /usr/local/bin/patch-roo-code.sh
|
||||
|
||||
# Copy the crontab file into the container
|
||||
COPY crontab /etc/cron.d/laravel-cron
|
||||
RUN chmod 0644 /etc/cron.d/laravel-cron
|
||||
|
||||
@@ -173,5 +173,9 @@ add_teleport_labels
|
||||
service cron start
|
||||
nohup teleport start &
|
||||
|
||||
# Keep the Roo Code remote extension patched to use system ripgrep
|
||||
# (watcher mode: patches automatically when the extension is (re)installed)
|
||||
nohup /usr/local/bin/patch-roo-code.sh --watch >/var/log/patch-roo-code.log 2>&1 &
|
||||
|
||||
# Start the application with pm2
|
||||
exec pm2-runtime "php -t public -S 0.0.0.0:8000"
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# patch-roo-code.sh
|
||||
#
|
||||
# Roo Code (rooveterinaryinc.roo-cline) looks for a bundled ripgrep binary and
|
||||
# throws "Could not find ripgrep binary" inside remote/dev containers. This
|
||||
# script patches the remote extension.js so it uses the system-installed
|
||||
# ripgrep instead.
|
||||
#
|
||||
# Usage:
|
||||
# patch-roo-code.sh One-shot patch (idempotent, safe to re-run)
|
||||
# patch-roo-code.sh --watch Keep watching for (re)installs/updates of the
|
||||
# extension and patch automatically
|
||||
#
|
||||
# Environment overrides:
|
||||
# RG_PATH ripgrep binary to inject (default: /usr/bin/rg)
|
||||
# EXT_ROOT VS Code server extensions dir (default: $HOME/.vscode-server/extensions)
|
||||
# PATCH_ROO_INTERVAL poll interval in seconds for --watch (default: 30)
|
||||
|
||||
set -u
|
||||
|
||||
RG_PATH="${RG_PATH:-/usr/bin/rg}"
|
||||
EXT_ROOT="${EXT_ROOT:-$HOME/.vscode-server/extensions}"
|
||||
|
||||
# Returns: 0 = patched, 1 = already patched / string not found, 2 = extension not found
|
||||
patch_once() {
|
||||
local roo_remote_js
|
||||
roo_remote_js=$(ls -d "$EXT_ROOT"/rooveterinaryinc.roo-cline-*/dist/extension.js 2>/dev/null | tail -n1)
|
||||
|
||||
if [ -z "$roo_remote_js" ]; then
|
||||
echo "Roo Code extensie niet gevonden in $EXT_ROOT."
|
||||
return 2
|
||||
fi
|
||||
|
||||
if ! grep -q 'Could not find ripgrep binary' "$roo_remote_js"; then
|
||||
echo "String al aangepast of niet gevonden."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if command -v python3 >/dev/null 2>&1; then
|
||||
python3 - "$roo_remote_js" "$RG_PATH" <<'PYEOF'
|
||||
import sys
|
||||
|
||||
path, rg_path = sys.argv[1], sys.argv[2]
|
||||
|
||||
with open(path, 'r') as f:
|
||||
code = f.read()
|
||||
|
||||
patched = code.replace(
|
||||
'throw new Error("Could not find ripgrep binary")',
|
||||
'return "%s"' % rg_path,
|
||||
)
|
||||
|
||||
with open(path, 'w') as f:
|
||||
f.write(patched)
|
||||
PYEOF
|
||||
else
|
||||
sed -i "s|throw new Error(\"Could not find ripgrep binary\")|return \"$RG_PATH\"|g" "$roo_remote_js"
|
||||
fi
|
||||
|
||||
echo "Remote Roo Code succesvol gepatcht op de server! ($roo_remote_js)"
|
||||
return 0
|
||||
}
|
||||
|
||||
if [ "${1:-}" = "--watch" ]; then
|
||||
# The extension is installed/updated at runtime (when VS Code connects), so
|
||||
# poll periodically and only log when an actual patch was applied.
|
||||
while true; do
|
||||
if patch_once >/dev/null 2>&1; then
|
||||
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Remote Roo Code succesvol gepatcht op de server!"
|
||||
fi
|
||||
sleep "${PATCH_ROO_INTERVAL:-30}"
|
||||
done
|
||||
fi
|
||||
|
||||
patch_once
|
||||
@@ -1 +1 @@
|
||||
6.1
|
||||
6.2
|
||||
Reference in new issue
Block a user