fix: run container as host PUID/PGID for workspace mounts
node uid 1000 could not read /home/frank (frank=1002); build and compose now use configurable PUID/PGID. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+15
-10
@@ -1,7 +1,14 @@
|
||||
# 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 \
|
||||
@@ -19,28 +26,26 @@ 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
|
||||
|
||||
# Drop build toolchain from runtime image layer weight is optional; keep for native package installs
|
||||
# Re-install without g++ would break future pi packages needing compile — leave tools in.
|
||||
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
|
||||
|
||||
RUN mkdir -p /data/pi-web /workspaces /home/node/.pi/agent /home/node/.config/pi-web \
|
||||
&& chown -R node:node /data /workspaces /home/node/.pi /home/node/.config
|
||||
COPY --chown=pi:pi config/pi-web.config.json /etc/pi-web/config.json
|
||||
|
||||
COPY --chown=node:node config/pi-web.config.json /etc/pi-web/config.json
|
||||
|
||||
ENV HOME=/home/node \
|
||||
ENV HOME=/home/pi \
|
||||
PI_WEB_CONFIG=/etc/pi-web/config.json \
|
||||
PI_WEB_DATA_DIR=/data/pi-web \
|
||||
PI_CODING_AGENT_DIR=/home/node/.pi/agent \
|
||||
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="/usr/local/bin:${PATH}"
|
||||
|
||||
USER node
|
||||
USER pi
|
||||
WORKDIR /workspaces
|
||||
|
||||
EXPOSE 8504
|
||||
|
||||
# Default overridden per-service in compose.yml
|
||||
CMD ["pi-web-server"]
|
||||
|
||||
Reference in New Issue
Block a user