From 53af097928b00281857f3ca8010a14522705d174 Mon Sep 17 00:00:00 2001 From: Brian Rogers Date: Thu, 9 Apr 2026 16:35:08 -0600 Subject: [PATCH] adding claude stuff --- .claude/settings.local.json | 6 ++ Claude.Dockerfile | 155 ++++++++++++++++++++++++++++++++++++ rebuild-claude-docker.sh | 3 + run-claude-docker.sh | 6 ++ 4 files changed, 170 insertions(+) create mode 100644 .claude/settings.local.json create mode 100644 Claude.Dockerfile create mode 100755 rebuild-claude-docker.sh create mode 100755 run-claude-docker.sh diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..78c8763 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,6 @@ +{ + "enabledMcpjsonServers": [ + "laravel-boost" + ], + "enableAllProjectMcpServers": true +} diff --git a/Claude.Dockerfile b/Claude.Dockerfile new file mode 100644 index 0000000..23c9ce4 --- /dev/null +++ b/Claude.Dockerfile @@ -0,0 +1,155 @@ +FROM alpine:latest + +# --------------------------------------------------------------------------- +# 1. SYSTEM PACKAGES +# - curl is required for the native Claude Code bash installer +# - nodejs / npm / pnpm are NO LONGER needed for Claude Code itself, +# but keep them if your project (e.g. Laravel front-end) needs them. +# Remove those three lines if you don't need Node in the container. +# - libgcc / libstdc++ / ripgrep are required by the native binary on +# Alpine (musl-based). Without these the installer will fail. +# --------------------------------------------------------------------------- +RUN apk add --no-cache \ + bash \ + ca-certificates \ + curl \ + tar \ + xz \ + libgcc \ + libstdc++ \ + ripgrep \ + mariadb-client \ + openssh-client \ + openssh-client-default \ + openssl \ + php84 \ + php84-bcmath \ + php84-bz2 \ + php84-curl \ + php84-dom \ + php84-exif \ + php84-fileinfo \ + php84-gd \ + php84-gettext \ + php84-gmp \ + php84-iconv \ + php84-imap \ + php84-intl \ + php84-mbstring \ + php84-mysqlnd \ + php84-pdo \ + php84-pdo_mysql \ + php84-pdo_pgsql \ + php84-pdo_sqlite \ + php84-pecl-apcu \ + php84-pecl-igbinary \ + php84-pecl-grpc \ + php84-pecl-lzf \ + php84-pecl-maxminddb \ + php84-pecl-msgpack \ + php84-pecl-redis \ + php84-pgsql \ + php84-phar \ + php84-posix \ + php84-session \ + php84-simplexml \ + php84-soap \ + php84-sockets \ + php84-sodium \ + php84-sqlite3 \ + php84-tokenizer \ + php84-xml \ + php84-xmlreader \ + php84-xmlwriter \ + php84-zip \ + sqlite + + +# --------------------------------------------------------------------------- +# 2. INSTALL COMPOSER (essential for PHP) +# --------------------------------------------------------------------------- +RUN curl -sS https://getcomposer.org/installer | php -- \ + --install-dir=/usr/local/bin --filename=composer + + +# --------------------------------------------------------------------------- +# 3. NON-ROOT USER +# Create a user whose UID/GID matches your host user so that any files +# written inside the container are owned by YOU on the host, not root. +# +# HOW TO USE: +# Pass --build-arg HOST_UID=$(id -u) --build-arg HOST_GID=$(id -g) +# when you run `docker build`, or hard-code the values below. +# +# Example build command: +# docker build \ +# --build-arg HOST_UID=$(id -u) \ +# --build-arg HOST_GID=$(id -g) \ +# -t my-claude-image . +# +# Example run command (mount your project into /app): +# docker run --rm -it \ +# -v "$(pwd)":/app \ +# -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ +# my-claude-image +# --------------------------------------------------------------------------- +ARG HOST_UID=1000 +ARG HOST_GID=1000 + +RUN addgroup -g "${HOST_GID}" brian \ + && adduser -D -u "${HOST_UID}" -G brian -s /bin/bash brian + + +# --------------------------------------------------------------------------- +# 4. INSTALL CLAUDE CODE (native bash installer – Anthropic recommended) +# The native binary: +# • Requires NO Node.js +# • Auto-updates in the background +# • Installs to ~/.local/bin (per-user, no sudo required) +# +# On Alpine the installer needs USE_BUILTIN_RIPGREP=0 because the +# bundled ripgrep binary is glibc-linked; we installed ripgrep via apk +# above instead. +# +# We switch to the brian for the install so the binary lands in +# /home/brian/.local/bin (not /root/.local/bin). +# --------------------------------------------------------------------------- +USER brian +ENV HOME=/home/brian +ENV USE_BUILTIN_RIPGREP=0 + +RUN curl -fsSL https://claude.ai/install.sh | bash + +# Make sure the installed binary is on PATH for subsequent RUN steps and +# at container runtime. +ENV PATH="/home/brian/.local/bin:${PATH}" + +# --------------------------------------------------------------------------- +# 5. APP DIRECTORIES +# Create persistent-data dirs as the non-root user so Claude Code can +# read/write its config without permission errors. +# --------------------------------------------------------------------------- +RUN mkdir -p /home/brian/.config/claude-code \ + && mkdir -p /home/brian/.ssh \ + && mkdir -p /home/brian/app + + +# --------------------------------------------------------------------------- +# 5.1 DIRECTORY PERMISSIONS +# Adjust permissions on some directories as needed. +# --------------------------------------------------------------------------- +RUN chmod 700 /home/brian/.ssh + + +# --------------------------------------------------------------------------- +# 6. WORKDIR & SHELL +# --------------------------------------------------------------------------- +WORKDIR /home/brian/app + +SHELL ["/bin/bash", "-c"] + + +# --------------------------------------------------------------------------- +# 7. DEFAULT COMMAND +# --------------------------------------------------------------------------- +CMD ["claude"] diff --git a/rebuild-claude-docker.sh b/rebuild-claude-docker.sh new file mode 100755 index 0000000..9aacabf --- /dev/null +++ b/rebuild-claude-docker.sh @@ -0,0 +1,3 @@ +#!/usr/bin/bash + +docker build --tag claude-code-shopcart:latest --file Claude.Dockerfile . diff --git a/run-claude-docker.sh b/run-claude-docker.sh new file mode 100755 index 0000000..3a77891 --- /dev/null +++ b/run-claude-docker.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +docker run -it --rm \ + -v /code/php/sites/shopping-cart:/home/brian/app \ + --name claude-code-shopcart \ + claude-code-shopcart