This commit is contained in:
Tim Lappe 2025-03-23 11:47:09 +01:00
parent cdae29c493
commit a0e70f85cb
7 changed files with 101 additions and 0 deletions

60
Dockerfile Normal file
View File

@ -0,0 +1,60 @@
FROM debian:bullseye
ARG OPENAI_API_KEY
# Install Node.js and required dependencies
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
ca-certificates \
gcc \
libc6-dev \
wget \
curl \
gnupg \
bzip2 \
libdbus-1-dev \
libxcb1 \
libxcb-render0 \
libxcb-shape0 \
libxcb-xfixes0 \
git \
zip \
unzip \
; \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - ; \
apt-get install -y nodejs; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*
# Install Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
RUN apt-get update && apt-get install -y nodejs
# Create user with home directory
RUN useradd -m -s /bin/bash goose && \
usermod -aG sudo goose && \
echo "goose ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
COPY agent/.config/goose/config.yaml /home/goose/.config/goose/config.yaml
COPY agent/.bashrc /home/goose/.bashrc
COPY entrypoint.sh /home/goose/entrypoint.sh
COPY instructions.md /home/goose/instructions.md
RUN chmod +x /home/goose/entrypoint.sh
# Switch to non-root user
USER goose
WORKDIR /home/goose
RUN curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | CANARY=true bash
RUN git clone https://github.com/hekmon8/homeassistant-server-mcp homeassistant-server-mcp && \
cd homeassistant-server-mcp && \
npm install && \
npm run build
COPY homeassistant-mcp/.env /home/goose/homeassistant-mcp/.env
ENTRYPOINT ["/home/goose/entrypoint.sh"]

3
agent/.bashrc Normal file
View File

@ -0,0 +1,3 @@
export OPENAI_API_KEY="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"
export HOMEASSISTANT_API_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwYmM2MjYwODViMTI0Y2E2YTY1OTE5ZWYzMjg5ZjgyOSIsImlhdCI6MTc0MjcyNTQ5NywiZXhwIjoyMDU4MDg1NDk3fQ.rn1yhQ5AkSiHAnyt119WUQ8K80xgnxrtIXBiFwmp7l4"
export PATH="$HOME/.local/bin:$PATH"

View File

@ -0,0 +1,16 @@
OPENAI_HOST: https://api.openai.com
OPENAI_BASE_PATH: /v1/chat/completions
GOOSE_PROVIDER: openai
GOOSE_MODEL: gpt-4o
extensions:
homeassistant:
name: Home Assistant
cmd: "node"
args: ["homeassistant-server-mcp/build/index.js"]
envs:
HA_URL: https://ha.strolap.com
HA_TOKEN: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwYmM2MjYwODViMTI0Y2E2YTY1OTE5ZWYzMjg5ZjgyOSIsImlhdCI6MTc0MjcyNTQ5NywiZXhwIjoyMDU4MDg1NDk3fQ.rn1yhQ5AkSiHAnyt119WUQ8K80xgnxrtIXBiFwmp7l4
enabled: true
type: stdio
timeout: 300

8
docker-compose.yml Normal file
View File

@ -0,0 +1,8 @@
services:
agent:
build:
context: .
args:
OPENAI_API_KEY: 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
volumes:
- .:/app

5
entrypoint.sh Normal file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source ~/.bashrc
~/.local/bin/goose run -i instructions.md

8
homeassistant-mcp/.env Normal file
View File

@ -0,0 +1,8 @@
# Home Assistant Configuration
HA_URL=https://ha.strolap.com
HA_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiIwYmM2MjYwODViMTI0Y2E2YTY1OTE5ZWYzMjg5ZjgyOSIsImlhdCI6MTc0MjcyNTQ5NywiZXhwIjoyMDU4MDg1NDk3fQ.rn1yhQ5AkSiHAnyt119WUQ8K80xgnxrtIXBiFwmp7l4
# Server Configuration
PORT=3000
NODE_ENV=production
DEBUG=false

1
instructions.md Normal file
View File

@ -0,0 +1 @@
Erstelle eine Automation, die in 5 minuten das Licht im Wohnzimmer ausmacht (light.couch)