Files
Frank Schwenk 063b16296c feat: install Cursor Agent CLI in image with API key auth
Bake agent into the pi user PATH; pass CURSOR_API_KEY from .env so no browser login is required.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-01 11:50:30 +02:00

58 lines
1.6 KiB
Docker

# Pi Coding Agent + PI WEB (Plain Docker)
# Peer pin: pi-web requires pi-coding-agent >=0.82.1 <0.83
# Run as host UID/GID so bind-mounted /home/frank (etc.) is readable.
ARG PUID=1002
ARG PGID=1002
FROM node:24-bookworm-slim
ARG PUID=1002
ARG PGID=1002
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bash \
ca-certificates \
curl \
git \
python3 \
make \
g++ \
ripgrep \
&& rm -rf /var/lib/apt/lists/*
# Agent first (peer for pi-web), then PI WEB with node-pty native build
RUN npm install -g --ignore-scripts @earendil-works/pi-coding-agent@0.82.1 \
&& npm install -g @jmfederico/pi-web@1.202607.3 --allow-scripts=node-pty \
&& npm cache clean --force
RUN groupadd -g "${PGID}" pi \
&& useradd -u "${PUID}" -g "${PGID}" -m -d /home/pi -s /bin/bash pi \
&& mkdir -p /data/pi-web /workspaces /home/pi/.pi/agent /home/pi/.config/pi-web \
&& chown -R pi:pi /data /workspaces /home/pi
COPY --chown=pi:pi config/pi-web.config.json /etc/pi-web/config.json
ENV HOME=/home/pi \
PI_WEB_CONFIG=/etc/pi-web/config.json \
PI_WEB_DATA_DIR=/data/pi-web \
PI_CODING_AGENT_DIR=/home/pi/.pi/agent \
PI_WEB_SESSIOND_SOCKET=/data/pi-web/sessiond.sock \
PI_WEB_HOST=0.0.0.0 \
PI_WEB_PORT=8504 \
PI_WEB_ALLOWED_HOSTS=pi.schwenk.online \
PATH="/home/pi/.local/bin:/home/pi/.cursor/bin:/usr/local/bin:${PATH}"
USER pi
# Cursor Agent CLI — auth via CURSOR_API_KEY at runtime (not baked into image)
# https://cursor.com/docs/cli/installation
RUN curl -fsSL https://cursor.com/install | bash \
&& agent --version
WORKDIR /workspaces
EXPOSE 8504
CMD ["pi-web-server"]