Compare commits
2 Commits
7ec1eb9120
...
e4d4df16ad
| Author | SHA1 | Date | |
|---|---|---|---|
| e4d4df16ad | |||
| 5bf5701e0d |
@@ -1,27 +1,34 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: gitea.lemarechal.eu
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: gitea.lemarechal.eu/aydent/clawdbot:latest
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
registry: gitea.lemarechal.eu
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.PACKAGES_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
push: false
|
||||
load: true
|
||||
tags: gitea.lemarechal.eu/aydent/clawdbot:latest
|
||||
|
||||
- name: Restart Service
|
||||
run: |
|
||||
# The image is now in the local docker daemon (Host) thanks to the shared socket
|
||||
docker compose up -d --force-recreate clawdbot
|
||||
docker image prune -f
|
||||
|
||||
130
Dockerfile
130
Dockerfile
@@ -1,65 +1,65 @@
|
||||
# Stage 1: Builder
|
||||
FROM node:22-bookworm AS builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
git \
|
||||
python3 \
|
||||
make \
|
||||
g++ \
|
||||
socat \
|
||||
unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Bun
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV BUN_INSTALL="/root/.bun"
|
||||
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Clone with depth 1 to save space (removes history)
|
||||
RUN git clone --depth 1 https://github.com/moltbot/moltbot.git .
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Build Backend
|
||||
RUN CLAWDBOT_A2UI_SKIP_MISSING=1 pnpm build
|
||||
|
||||
# Build UI
|
||||
ENV CLAWDBOT_PREFER_PNPM=1
|
||||
RUN pnpm ui:install
|
||||
RUN pnpm ui:build
|
||||
|
||||
# Remove devDependencies to reduce size
|
||||
RUN CI=true pnpm prune --prod --ignore-scripts
|
||||
|
||||
# Remove .git folder to save space
|
||||
RUN rm -rf .git
|
||||
|
||||
# Stage 2: Runner
|
||||
FROM node:22-bookworm-slim
|
||||
|
||||
WORKDIR /home/node/app
|
||||
|
||||
# Install runtime dependencies (lightweight)
|
||||
# build tools (make, g++) are not needed for runtime
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
socat \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set user
|
||||
USER node
|
||||
|
||||
# Copy application from builder
|
||||
# We copy the entire folder as pruned by 'pnpm prune --prod'
|
||||
COPY --from=builder --chown=node:node /app /home/node/app
|
||||
|
||||
# Start
|
||||
CMD ["node", "dist/index.js"]
|
||||
# Stage 1: Builder
|
||||
FROM node:22-bookworm AS builder
|
||||
|
||||
# Install build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
curl \
|
||||
git \
|
||||
python3 \
|
||||
make \
|
||||
g++ \
|
||||
socat \
|
||||
unzip \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Bun
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
ENV BUN_INSTALL="/root/.bun"
|
||||
ENV PATH="${BUN_INSTALL}/bin:${PATH}"
|
||||
|
||||
RUN corepack enable
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Clone with depth 1 to save space (removes history)
|
||||
RUN git clone --depth 1 https://github.com/moltbot/moltbot.git .
|
||||
|
||||
# Install dependencies
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Build Backend
|
||||
RUN CLAWDBOT_A2UI_SKIP_MISSING=1 pnpm build
|
||||
|
||||
# Build UI
|
||||
ENV CLAWDBOT_PREFER_PNPM=1
|
||||
RUN pnpm ui:install
|
||||
RUN pnpm ui:build
|
||||
|
||||
# Remove devDependencies to reduce size
|
||||
RUN CI=true pnpm prune --prod --ignore-scripts
|
||||
|
||||
# Remove .git folder to save space
|
||||
RUN rm -rf .git
|
||||
|
||||
# Stage 2: Runner
|
||||
FROM node:22-bookworm-slim
|
||||
|
||||
WORKDIR /home/node/app
|
||||
|
||||
# Install runtime dependencies (lightweight)
|
||||
# build tools (make, g++) are not needed for runtime
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
socat \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set user
|
||||
USER node
|
||||
|
||||
# Copy application from builder
|
||||
# We copy the entire folder as pruned by 'pnpm prune --prod'
|
||||
COPY --from=builder --chown=node:node /app /home/node/app
|
||||
|
||||
# Start
|
||||
CMD ["node", "dist/index.js"]
|
||||
|
||||
60
README.md
60
README.md
@@ -1,30 +1,30 @@
|
||||
# Clawdbot Build Repository
|
||||
|
||||
Ce répository contient la configuration de build et de déploiement pour l'agent Clawdbot.
|
||||
|
||||
## Prérequis VPS
|
||||
|
||||
Avant le premier déploiement, vous devez préparer les répertoires sur le VPS pour la persistance des données.
|
||||
|
||||
Exécutez les commandes suivantes sur le serveur :
|
||||
|
||||
```bash
|
||||
# Création des dossiers
|
||||
sudo mkdir -p /opt/clawdbot/config
|
||||
sudo mkdir -p /opt/clawdbot/workspace
|
||||
|
||||
# Attribution des permissions (UID:GID 1000:1000 pour l'utilisateur node)
|
||||
sudo chown -R 1000:1000 /opt/clawdbot
|
||||
```
|
||||
|
||||
## Déploiement
|
||||
|
||||
Le déploiement est automatisé via Gitea Actions. Chaque push sur la branche `main` déclenchera la construction de l'image Docker et son push vers le registre `gitea.lemarechal.eu`.
|
||||
|
||||
### Configuration
|
||||
Le fichier `docker-compose.yml` utilise l'image `gitea.lemarechal.eu/aydent/clawdbot:latest` et configure Traefik pour l'accès au Dashboard.
|
||||
|
||||
Assurez-vous que les variables d'environnement suivantes sont définies dans votre contexte de déploiement (ou fichier `.env` si déploiement manuel) :
|
||||
- `GOOGLE_API_KEY`
|
||||
- `DISCORD_BOT_TOKEN`
|
||||
- `CLAWDBOT_GATEWAY_TOKEN`
|
||||
# Clawdbot Build Repository
|
||||
|
||||
Ce répository contient la configuration de build et de déploiement pour l'agent Clawdbot.
|
||||
|
||||
## Prérequis VPS
|
||||
|
||||
Avant le premier déploiement, vous devez préparer les répertoires sur le VPS pour la persistance des données.
|
||||
|
||||
Exécutez les commandes suivantes sur le serveur :
|
||||
|
||||
```bash
|
||||
# Création des dossiers
|
||||
sudo mkdir -p /opt/clawdbot/config
|
||||
sudo mkdir -p /opt/clawdbot/workspace
|
||||
|
||||
# Attribution des permissions (UID:GID 1000:1000 pour l'utilisateur node)
|
||||
sudo chown -R 1000:1000 /opt/clawdbot
|
||||
```
|
||||
|
||||
## Déploiement
|
||||
|
||||
Le déploiement est automatisé via Gitea Actions. Chaque push sur la branche `main` déclenchera la construction de l'image Docker et son push vers le registre `gitea.lemarechal.eu`.
|
||||
|
||||
### Configuration
|
||||
Le fichier `docker-compose.yml` utilise l'image `gitea.lemarechal.eu/aydent/clawdbot:latest` et configure Traefik pour l'accès au Dashboard.
|
||||
|
||||
Assurez-vous que les variables d'environnement suivantes sont définies dans votre contexte de déploiement (ou fichier `.env` si déploiement manuel) :
|
||||
- `GOOGLE_API_KEY`
|
||||
- `DISCORD_BOT_TOKEN`
|
||||
- `CLAWDBOT_GATEWAY_TOKEN`
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
{
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model": {
|
||||
"primary": "google/gemini-1.5-pro"
|
||||
}
|
||||
}
|
||||
},
|
||||
"channels": {
|
||||
"discord": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
"port": 18789
|
||||
}
|
||||
}
|
||||
{
|
||||
"agents": {
|
||||
"defaults": {
|
||||
"model": {
|
||||
"primary": "google/gemini-1.5-pro"
|
||||
}
|
||||
}
|
||||
},
|
||||
"channels": {
|
||||
"discord": {
|
||||
"enabled": true
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"host": "0.0.0.0",
|
||||
"port": 18789
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
services:
|
||||
clawdbot:
|
||||
container_name: clawdbot
|
||||
image: gitea.lemarechal.eu/aydent/clawdbot:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- GOOGLE_API_KEY
|
||||
- DISCORD_BOT_TOKEN
|
||||
- CLAWDBOT_GATEWAY_TOKEN
|
||||
- XDG_CONFIG_HOME=/home/node/.clawdbot
|
||||
volumes:
|
||||
- /opt/clawdbot/config:/home/node/.clawdbot
|
||||
- /opt/clawdbot/workspace:/home/node/clawd
|
||||
networks:
|
||||
- traefik-net
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Router for the Dashboard
|
||||
- "traefik.http.routers.clawdbot.rule=Host(`assistant.lemarechal.eu`)"
|
||||
- "traefik.http.routers.clawdbot.entrypoints=https"
|
||||
- "traefik.http.routers.clawdbot.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.routers.clawdbot.middlewares=auth-sso@docker"
|
||||
# Service definition
|
||||
- "traefik.http.services.clawdbot.loadbalancer.server.port=18789"
|
||||
|
||||
networks:
|
||||
traefik-net:
|
||||
external: true
|
||||
services:
|
||||
clawdbot:
|
||||
container_name: clawdbot
|
||||
image: gitea.lemarechal.eu/aydent/clawdbot:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- GOOGLE_API_KEY
|
||||
- DISCORD_BOT_TOKEN
|
||||
- CLAWDBOT_GATEWAY_TOKEN
|
||||
- XDG_CONFIG_HOME=/home/node/.clawdbot
|
||||
volumes:
|
||||
- /opt/clawdbot/config:/home/node/.clawdbot
|
||||
- /opt/clawdbot/workspace:/home/node/clawd
|
||||
networks:
|
||||
- traefik-net
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
# Router for the Dashboard
|
||||
- "traefik.http.routers.clawdbot.rule=Host(`assistant.lemarechal.eu`)"
|
||||
- "traefik.http.routers.clawdbot.entrypoints=https"
|
||||
- "traefik.http.routers.clawdbot.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.routers.clawdbot.middlewares=auth-sso@docker"
|
||||
# Service definition
|
||||
- "traefik.http.services.clawdbot.loadbalancer.server.port=18789"
|
||||
|
||||
networks:
|
||||
traefik-net:
|
||||
external: true
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
runner:
|
||||
image: gitea/act_runner:latest
|
||||
container_name: clawdbot-runner
|
||||
restart: always
|
||||
environment:
|
||||
# URL of your Gitea instance
|
||||
- GITEA_INSTANCE_URL=https://gitea.lemarechal.eu
|
||||
# Token obtained from Gitea > Site Administration > Actions > Runners > Create Logger
|
||||
# OR Repository > Settings > Actions > Runners
|
||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${RUNNER_TOKEN}
|
||||
- GITEA_RUNNER_NAME=internal-runner
|
||||
# Default labels
|
||||
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:22-bookworm,ubuntu-22.04:docker://node:16-bullseye
|
||||
volumes:
|
||||
# Persist configuration and data
|
||||
- ./data:/data
|
||||
# Allow launching sibling containers for builds
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
runner:
|
||||
image: gitea/act_runner:latest
|
||||
container_name: clawdbot-runner
|
||||
restart: always
|
||||
environment:
|
||||
# URL of your Gitea instance
|
||||
- GITEA_INSTANCE_URL=https://gitea.lemarechal.eu
|
||||
# Token obtained from Gitea > Site Administration > Actions > Runners > Create Logger
|
||||
# OR Repository > Settings > Actions > Runners
|
||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${RUNNER_TOKEN}
|
||||
- GITEA_RUNNER_NAME=internal-runner
|
||||
# Default labels
|
||||
# Use an image that contains Docker CLI, Git, and Node.js
|
||||
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://catthehacker/ubuntu:act-latest
|
||||
volumes:
|
||||
# Persist configuration and data
|
||||
- ./data:/data
|
||||
# Allow launching sibling containers for builds
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
|
||||
Reference in New Issue
Block a user