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>
19 lines
428 B
Docker
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"]
|