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