Custom workspace image + fix slash command invocation
Publish Workspace Image / publish (push) Successful in 3m51s
Details
Publish Workspace Image / publish (push) Successful in 3m51s
Details
- Add coder/workspace.Dockerfile with Node.js 22, wrangler, claude-code, and Playwright deps pre-installed. Eliminates ~3 min of installs on every workspace startup. - Add CI workflow to build and push to registry.samson.media/coder-workspace - Fix slash command: -p mode doesn't support /commands, so read the .md file directly, strip frontmatter, substitute $ARGUMENTS, pass as prompt - Switch workspace image from codercom/enterprise-base to custom image Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
d46e3ca247
commit
520fc8f81e
|
|
@ -0,0 +1,27 @@
|
|||
name: Publish Workspace Image
|
||||
|
||||
on:
|
||||
push:
|
||||
paths:
|
||||
- 'coder/workspace.Dockerfile'
|
||||
branches:
|
||||
- main
|
||||
|
||||
concurrency:
|
||||
group: publish-workspace
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: self-hosted
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to registry
|
||||
run: echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login registry.samson.media -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
||||
|
||||
- name: Build and push
|
||||
run: |
|
||||
IMAGE=registry.samson.media/coder-workspace
|
||||
docker build -f coder/workspace.Dockerfile -t "$IMAGE:latest" .
|
||||
docker push "$IMAGE:latest"
|
||||
|
|
@ -478,28 +478,6 @@ resource "coder_agent" "main" {
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# --- Install Node.js 22 ---
|
||||
if ! command -v node &> /dev/null; then
|
||||
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
|
||||
sudo apt-get install -y nodejs
|
||||
fi
|
||||
|
||||
# --- Install global tools ---
|
||||
if ! command -v wrangler &> /dev/null; then
|
||||
sudo npm install -g wrangler @anthropic-ai/claude-code
|
||||
fi
|
||||
|
||||
# --- Install Playwright system dependencies ---
|
||||
if ! dpkg -s libgbm1 &> /dev/null; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
|
||||
libcups2t64 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \
|
||||
libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2t64 libatspi2.0-0 \
|
||||
|| sudo apt-get install -y libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
|
||||
libcups2 libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \
|
||||
libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2 libatspi2.0-0
|
||||
fi
|
||||
|
||||
# --- Configure git ---
|
||||
git config --global user.name "${data.coder_workspace_owner.me.full_name}"
|
||||
git config --global user.email "${data.coder_workspace_owner.me.email}"
|
||||
|
|
@ -579,8 +557,16 @@ LOGEOF
|
|||
ARGS="$DEPLOY_ENV"
|
||||
fi
|
||||
|
||||
# Read the slash command .md file, strip YAML frontmatter, substitute $ARGUMENTS
|
||||
CMD_FILE=".claude/commands/$TASK_TYPE.md"
|
||||
if [ ! -f "$CMD_FILE" ]; then
|
||||
echo "ERROR: Command file not found: $CMD_FILE" | tee ~/task-output.log
|
||||
exit 1
|
||||
fi
|
||||
PROMPT=$(sed '1{/^---$/!q}; 1,/^---$/d' "$CMD_FILE" | sed "s/\\\$ARGUMENTS/$ARGS/g")
|
||||
|
||||
# Run Claude Code in non-interactive mode with tool access
|
||||
claude -p --dangerously-skip-permissions --verbose "/$TASK_TYPE $ARGS" 2>&1 | tee ~/task-output.log
|
||||
claude -p --dangerously-skip-permissions --verbose "$PROMPT" 2>&1 | tee ~/task-output.log
|
||||
EXIT_CODE=$?
|
||||
echo "Claude exited with code: $EXIT_CODE" | tee -a ~/task-output.log
|
||||
|
||||
|
|
@ -691,7 +677,7 @@ resource "kubernetes_deployment_v1" "workspace" {
|
|||
|
||||
container {
|
||||
name = "coder-agent"
|
||||
image = "codercom/enterprise-base:latest"
|
||||
image = "registry.samson.media/coder-workspace:latest"
|
||||
|
||||
command = ["sh", "-c", coder_agent.main.init_script]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
FROM codercom/enterprise-base:latest
|
||||
|
||||
USER root
|
||||
|
||||
# Node.js 22
|
||||
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Global npm tools
|
||||
RUN npm install -g wrangler @anthropic-ai/claude-code
|
||||
|
||||
# Playwright system dependencies (both Ubuntu 24.04 and 22.04 package names)
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 \
|
||||
libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 \
|
||||
libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libatspi2.0-0 \
|
||||
jq netcat-openbsd \
|
||||
&& (apt-get install -y libcups2t64 libasound2t64 2>/dev/null \
|
||||
|| apt-get install -y libcups2 libasound2 2>/dev/null) \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
USER coder
|
||||
Loading…
Reference in New Issue