feat: Docker para CBC con acceso limitado
- Dockerfile minimal con Python 3.11 - docker-compose.yml con volumenes controlados - .dockerignore para build eficiente - Script de inicio start.sh - .env.example para configuración Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
16
docker/.dockerignore
Normal file
16
docker/.dockerignore
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Excluir archivos innecesarios del build
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
__pycache__
|
||||||
|
*.pyc
|
||||||
|
.venv
|
||||||
|
*.log
|
||||||
|
downloads/
|
||||||
|
transcriptions/
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
*.md
|
||||||
|
!docker/README.md
|
||||||
|
node_modules/
|
||||||
|
.DS_Store
|
||||||
14
docker/.env.example
Normal file
14
docker/.env.example
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# CBCFacil - Configuración Docker
|
||||||
|
# Copiar a .env y completar con tus credenciales
|
||||||
|
|
||||||
|
# API Keys
|
||||||
|
ANTHROPIC_AUTH_TOKEN=tu_token_aqui
|
||||||
|
|
||||||
|
# Nextcloud
|
||||||
|
NEXTCLOUD_URL=https://nextcloud.tudominio.com/remote.php/webdav
|
||||||
|
NEXTCLOUD_USER=tu_usuario
|
||||||
|
NEXTCLOUD_PASSWORD=tu_password
|
||||||
|
|
||||||
|
# Telegram
|
||||||
|
TELEGRAM_TOKEN=tu_token_bot
|
||||||
|
TELEGRAM_CHAT_ID=tu_chat_id
|
||||||
35
docker/Dockerfile
Normal file
35
docker/Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# CBC OpenClaw - Imagen Docker minimal
|
||||||
|
# Solo acceso a /app y las tools necesarias
|
||||||
|
|
||||||
|
FROM python:3.11-slim
|
||||||
|
|
||||||
|
# Instalar dependencias del sistema
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
git \
|
||||||
|
curl \
|
||||||
|
wget \
|
||||||
|
build-essential \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Crear usuario no-root para seguridad
|
||||||
|
RUN useradd -m -s /bin/bash cbc && \
|
||||||
|
mkdir -p /home/cbc && \
|
||||||
|
chown -R cbc:cbc /home/cbc
|
||||||
|
|
||||||
|
# Definir workspace
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Copiar solo archivos necesarios del proyecto
|
||||||
|
COPY --chown=cbc:cbc . .
|
||||||
|
|
||||||
|
# Cambiar a usuario no-root
|
||||||
|
USER cbc
|
||||||
|
|
||||||
|
# Variables de entorno para el agente
|
||||||
|
ENV ANTHROPIC_API_KEY=""
|
||||||
|
ENV ANTHROPIC_BASE_URL="https://api.minimax.io/anthropic"
|
||||||
|
ENV ANTHROPIC_MODEL="MiniMax-M2.5"
|
||||||
|
ENV HOME=/app
|
||||||
|
|
||||||
|
# El agente solo puede acceder a /app y sus subdirectorios
|
||||||
|
# No tiene acceso a Internet directo (solo a través de variables de entorno)
|
||||||
10
docker/README.md
Normal file
10
docker/README.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# CBC OpenClaw - Dockerizado con acceso limitado
|
||||||
|
|
||||||
|
## Estructura
|
||||||
|
|
||||||
|
```
|
||||||
|
docker/
|
||||||
|
├── Dockerfile
|
||||||
|
├── docker-compose.yml
|
||||||
|
├── .dockerignore
|
||||||
|
└── README.md
|
||||||
34
docker/docker-compose.yml
Normal file
34
docker/docker-compose.yml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
cbc-openclaw:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
container_name: cbc-openclaw
|
||||||
|
volumes:
|
||||||
|
# Solo montar las carpetas necesarias
|
||||||
|
- ../:/app
|
||||||
|
# Montar credenciales desde variables de entorno o archivo seguro
|
||||||
|
- ~/.env:/app/.env:ro
|
||||||
|
environment:
|
||||||
|
# API Keys - pasar desde host
|
||||||
|
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}
|
||||||
|
- ANTHROPIC_AUTH_TOKEN=${ANTHROPIC_AUTH_TOKEN}
|
||||||
|
- ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic
|
||||||
|
- ANTHROPIC_MODEL=MiniMax-M2.5
|
||||||
|
# Configuración CBC
|
||||||
|
- NEXTCLOUD_URL=${NEXTCLOUD_URL}
|
||||||
|
- NEXTCLOUD_USER=${NEXTCLOUD_USER}
|
||||||
|
- NEXTCLOUD_PASSWORD=${NEXTCLOUD_PASSWORD}
|
||||||
|
- TELEGRAM_TOKEN=${TELEGRAM_TOKEN}
|
||||||
|
- TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
|
||||||
|
working_dir: /app
|
||||||
|
command: ["python3", "main.py"]
|
||||||
|
restart: unless-stopped
|
||||||
|
networks:
|
||||||
|
- cbc-network
|
||||||
|
|
||||||
|
networks:
|
||||||
|
cbc-network:
|
||||||
|
driver: bridge
|
||||||
20
docker/start.sh
Executable file
20
docker/start.sh
Executable file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# CBC OpenClaw - Script de inicio Docker
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Cargar variables de entorno si existe .env
|
||||||
|
if [ -f ".env" ]; then
|
||||||
|
export $(cat .env | grep -v '^#' | xargs)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🟢 Iniciando CBC OpenClaw..."
|
||||||
|
|
||||||
|
# Construir imagen si no existe
|
||||||
|
docker compose -f docker/docker-compose.yml build
|
||||||
|
|
||||||
|
# Iniciar contenedor
|
||||||
|
docker compose -f docker/docker-compose.yml up -d
|
||||||
|
|
||||||
|
echo "✅ CBC OpenClaw corriendo en http://localhost:5000"
|
||||||
|
echo "📝 Ver logs: docker compose -f docker/docker-compose.yml logs -f"
|
||||||
Reference in New Issue
Block a user