From fa126651def1f460d6b44d145da8f94cff3fc7cd Mon Sep 17 00:00:00 2001 From: uxname Date: Mon, 2 Jun 2025 20:54:29 +0300 Subject: [PATCH] Adds Dockerfile, docker-compose, and updates README. --- Dockerfile | 10 ++++++ README.md | 81 +++++++++++++++++++++++++++++++--------------- docker-compose.yml | 10 ++++++ 3 files changed, 75 insertions(+), 26 deletions(-) create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ecb5e55 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM oven/bun:alpine + +WORKDIR /app + +COPY . . +RUN apk add git && bun install && bun run build && rm -rf .git + +ENV NODE_ENV=production + +CMD ["bun", "start"] diff --git a/README.md b/README.md index 0522e0e..f5b5b67 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,82 @@ -# AI Pipelines with Telegram Bot +# Aptos Hackathon -This project provides a framework for creating and executing AI-powered pipelines, with a Telegram bot interface for easy interaction. +Project for Aptos Hackathon (backend) ## Features -- Execute AI-powered pipelines using OpenAI's models -- Integration with Model Context Protocol (MCP) tools -- Telegram bot interface for easy interaction +- Execute AI pipelines using OpenAI models +- Integration with Model Context Protocol (MCP) +- Convenient Telegram bot interface - Support for dynamic prompts and variables -## Prerequisites +## Running with Docker Compose (Recommended) -- Node.js and Bun installed -- OpenAI API key -- Telegram Bot Token (get it from [@BotFather](https://t.me/botfather)) +### Prerequisites -## Setup +- Docker and Docker Compose installed +- `.env` file with required environment variables -1. Clone the repository -2. Install dependencies: +### Setup -```bash -bun install -``` - -3. Copy `.env.example` to `.env` and fill in your credentials: +1. Copy `.env.example` to `.env` and configure the settings: ```bash cp .env.example .env ``` -4. Edit the `.env` file and add your: +2. Edit the `.env` file and set: - `OPENAI_API_KEY` - Your OpenAI API key - - `TELEGRAM_BOT_TOKEN` - Your Telegram bot token from @BotFather - - `MCP_SERVER_URL` - (Optional) MCP server URL (defaults to Santiment's MCP server) + - `TELEGRAM_BOT_TOKEN` - Your Telegram bot token (get it from @BotFather) + - `MCP_SERVER_URL` - (Optional) MCP server URL -## Running the Bot +### Running the Application -Start the bot with: +Build and start the container: ```bash -bun start +docker-compose up --build -d ``` -Or in development mode with auto-reload: +### Viewing Logs + +```bash +docker-compose logs -f +``` + +### Stopping the Application + +```bash +docker-compose down +``` + +## Local Development + +### Prerequisites + +- Bun installed +- Node.js + +### Installing Dependencies + +```bash +bun install +``` + +### Running the Application + +In development mode with auto-reload: ```bash bun --watch src/main.ts ``` +Or in production mode: + +```bash +bun run build +bun start +``` + ## Using the Bot 1. Find your bot on Telegram using the username you set with @BotFather @@ -67,8 +95,9 @@ bun --watch src/main.ts ## Development - Run linter: `bun run lint` -- Run type checking: `bun run ts:check` -- Run both: `bun run check` +- Type checking: `bun run ts:check` +- Run all checks: `bun run check` +- Code formatting: `bun run lint:fix` ## License diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..08d8684 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +services: + app: + build: . + restart: unless-stopped + env_file: + - .env + volumes: + - ./.env:/app/.env + ports: + - "3000:3000"