36fce94692
Add a single-service docker-compose setup with bind-mounted config / templates / apps / playbooks / data so users can iterate on inventory and intents without rebuilding the image. Dockerfile uses python:3.12-slim with tini for clean signal handling, and ships openssh-client for in- container troubleshooting. Health check hits the /health endpoint. README documents project background, the L1-L5 architecture, both local and Docker deployment paths, configuration keys, intent template extension, and the safety model. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
44 lines
1.1 KiB
Docker
44 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1.6
|
|
FROM python:3.12-slim AS base
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1
|
|
|
|
WORKDIR /app
|
|
|
|
# 基础系统依赖:
|
|
# - gcc/libffi-dev : 编译某些 wheel(如 cryptography/asyncssh 依赖)
|
|
# - openssh-client : 提供 ssh 客户端工具,便于排障
|
|
# - tini : 优雅处理信号
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
gcc \
|
|
libffi-dev \
|
|
openssh-client \
|
|
tini \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 先安装依赖(pyproject + src 一起,以便 setuptools 发现包)
|
|
COPY pyproject.toml ./
|
|
COPY src/ ./src/
|
|
RUN pip install .
|
|
|
|
# 复制运行时资源(这些目录在 compose 里默认会被卷挂载覆盖)
|
|
COPY templates/ ./templates/
|
|
COPY config/ ./config/
|
|
COPY apps/ ./apps/
|
|
COPY playbooks/ ./playbooks/
|
|
|
|
# data/ 用于审计日志 + SQLite,运行时挂载卷
|
|
RUN mkdir -p /app/data
|
|
|
|
# 默认监听所有接口(容器内)
|
|
ENV OPS_HOST=0.0.0.0 \
|
|
OPS_PORT=8000
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
|
CMD ["ops", "serve"]
|