diff --git a/arcade/Makefile b/arcade/Makefile index 83815fa6..e2381cdb 100644 --- a/arcade/Makefile +++ b/arcade/Makefile @@ -1,3 +1,16 @@ +VENDOR ?= ArcadeAI +PROJECT ?= ArcadeAI +SOURCE ?= https://github.com/ArcadeAI/arcade-ai +LICENSE ?= MIT +DESCRIPTION ?= "Arcade AI for LLM Tool Serving" +REPOSITORY ?= arcadeai/arcade-ai + +VERSION ?= dev +COMMIT ?= $(shell git describe --dirty --always --abbrev=15) +BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") +IMAGE_NAME ?= actor +PORT ?= 8000 + .PHONY: install install: ## Install the poetry environment and install the pre-commit hooks @echo "🚀 Creating virtual environment using pyenv and poetry" @@ -47,8 +60,35 @@ docs-test: ## Test if documentation can be built without warnings or errors docs: ## Build and serve the documentation @poetry run mkdocs serve -a localhost:8777 +.PHONY: docker-build +docker-build: ## Build the Docker container + @echo "🛠️ Building Docker image ($(VERSION)).." + @echo "- Commit: $(COMMIT)" + @echo "- Build Date: $(BUILD_DATE)" + @docker build -f ../docker/Dockerfile ../ -t $(REPOSITORY):$(VERSION) \ + --build-arg PORT=$(PORT) \ + --build-arg VERSION="$(VERSION)" \ + --build-arg COMMIT="$(COMMIT)" \ + --build-arg BUILD_DATE="$(BUILD_DATE)" \ + --label=org.opencontainers.image.vendor="$(VENDOR)" \ + --label=org.opencontainers.image.title="$(PROJECT)" \ + --label=org.opencontainers.image.revision="$(COMMIT)" \ + --label=org.opencontainers.image.version="$(VERSION)" \ + --label=org.opencontainers.image.created="$(BUILD_DATE)" \ + --label=org.opencontainers.image.source="$(SOURCE)" \ + --label=org.opencontainers.image.licenses="$(LICENSE)" \ + --label=org.opencontainers.image.description=$(DESCRIPTION) + +.PHONY: docker-run +docker-run: ## Run the Docker container + @echo "🚀 Running Docker container ($(VERSION)).." + @docker run -p $(PORT):$(PORT) \ + -e WORK_DIR=/app/docker/ \ + $(REPOSITORY):$(VERSION) + .PHONY: help help: - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' + @echo "🛠️ Arcade AI Dev Commands:\n" + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' .DEFAULT_GOAL := help diff --git a/arcade/poetry.toml b/arcade/poetry.toml index ab1033bd..e69de29b 100644 --- a/arcade/poetry.toml +++ b/arcade/poetry.toml @@ -1,2 +0,0 @@ -[virtualenvs] -in-project = true diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..9d0742d8 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,53 @@ +# Use a lightweight Python image +FROM python:3.10-slim + +# Set environment variables +ENV POETRY_VERSION=1.8.3 +ENV PORT=8001 +ENV HOST=0.0.0.0 + +# Install system dependencies +RUN apt-get update && apt-get install -y \ + apt-utils \ + build-essential \ + libssl-dev \ + libffi-dev \ + python3-dev \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Install Poetry +RUN python -m pip install "poetry==$POETRY_VERSION" + +# Set the working directory +WORKDIR /app + +# Copy the parent directory contents into the container +COPY . . + +WORKDIR /app/arcade + +# Build the project and install the wheel with extras +RUN python -m poetry build && \ + pip install dist/arcade_ai-0.1.0-py3-none-any.whl[fastapi,dev] + +WORKDIR /app + +# Install toolkits from the toolkits directory +RUN set -e; \ + for toolkit in /app/toolkits/*; do \ + echo "Installing toolkit $(basename $toolkit) "; \ + cd $toolkit; \ + python -m poetry build; \ + pip install dist/*.whl; \ + done + +# Expose the port +EXPOSE $PORT + +WORKDIR /app/arcade + +RUN pip install uvicorn + +# Run the arcade dev command +CMD arcade dev --host $HOST --port $PORT diff --git a/docker/arcade.toml b/docker/arcade.toml new file mode 100644 index 00000000..e4965966 --- /dev/null +++ b/docker/arcade.toml @@ -0,0 +1,8 @@ +[api] +key = "123456789" +secret = "196a8a25-fde8-453a-9f58-ff646a6e034d" + +[engine] +host = "arcade-engine" +port = "9099" +tls = false diff --git a/docker/toolkits.txt b/docker/toolkits.txt new file mode 100644 index 00000000..732094f5 --- /dev/null +++ b/docker/toolkits.txt @@ -0,0 +1,3 @@ +gmail +github +websearch diff --git a/toolkits/github/pyproject.toml b/toolkits/github/pyproject.toml index 74b7adf8..7da0805f 100644 --- a/toolkits/github/pyproject.toml +++ b/toolkits/github/pyproject.toml @@ -6,7 +6,7 @@ authors = ["Nate Barbettini "] [tool.poetry.dependencies] python = "^3.10" -arcade-ai = "^0.1.0" +arcade-ai = "*" requests = "^2.32.3" [tool.poetry.dev-dependencies] diff --git a/toolkits/gmail/pyproject.toml b/toolkits/gmail/pyproject.toml index 20cedd97..10c101e6 100644 --- a/toolkits/gmail/pyproject.toml +++ b/toolkits/gmail/pyproject.toml @@ -6,13 +6,14 @@ authors = ["Sam Partee "] [tool.poetry.dependencies] python = "^3.10" -arcade-ai = "^0.1.0" +arcade-ai = "*" google-api-core = "2.19.1" google-api-python-client = "2.137.0" google-auth = "2.32.0" google-auth-httplib2 = "0.2.0" google-auth-oauthlib = "1.2.1" googleapis-common-protos = "1.63.2" +beautifulsoup4 = "^4.10.0" [tool.poetry.dev-dependencies] pytest = "^7.4.0" diff --git a/toolkits/math/pyproject.toml b/toolkits/math/pyproject.toml index 713920b4..ac6291ef 100644 --- a/toolkits/math/pyproject.toml +++ b/toolkits/math/pyproject.toml @@ -7,7 +7,7 @@ authors = ["Nate "] [tool.poetry.dependencies] python = "^3.10" -arcade-ai = {path = "../../arcade", develop = true} +arcade-ai = "*" [tool.poetry.dev-dependencies] pytest = "^7.4" diff --git a/toolkits/websearch/pyproject.toml b/toolkits/websearch/pyproject.toml index 0723a1fd..ea737292 100644 --- a/toolkits/websearch/pyproject.toml +++ b/toolkits/websearch/pyproject.toml @@ -6,7 +6,7 @@ authors = ["Sam Partee "] [tool.poetry.dependencies] python = "^3.10" -arcade-ai = "^0.1.0" +arcade-ai = "*" serpapi = "^0.1.5" [tool.poetry.dev-dependencies]