homelab-codex-ws/services/stability-agent/Dockerfile
Oskar Kapala 58ac6edd7d fix(stability-agent): run as uid 1000 with docker group access
stability-agent had no USER instruction and no user: in compose, running
as root and writing root-owned files to /opt/homelab bind-mount.

- Dockerfile: add useradd -m -u 1000 homelab + USER homelab
- docker-compose.yml: add user: "1000:1000" and group_add: ["999"]
  (GID 999 = docker group on VPS) to retain docker.sock:ro access

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 18:20:54 +02:00

19 lines
428 B
Docker

FROM python:3.11-slim
WORKDIR /app
# No extra dependencies needed beyond standard library for the current script
# But we might need them if we decide to use libraries later.
RUN useradd -m -u 1000 homelab
COPY src/stability_agent.py .
COPY healthcheck.sh .
RUN chmod +x healthcheck.sh
# Create the expected directories
RUN mkdir -p /opt/homelab/state /opt/homelab/events
USER homelab
CMD ["python", "stability_agent.py"]