From 0bb22299298bac97a4112dd93f7482b3fbbc9bc8 Mon Sep 17 00:00:00 2001 From: icebaker Date: Thu, 11 May 2023 22:12:16 -0300 Subject: adding docker support --- .gitignore | 1 + README.md | 38 ++++++++++++++++++++++++++++++++++++++ docker-compose.example.yml | 12 ++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 docker-compose.example.yml diff --git a/.gitignore b/.gitignore index 24ad4c4..023d2cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .env *.gem +docker-compose.yml diff --git a/README.md b/README.md index c2f9ac4..985f05a 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ _Image artificially created by Midjourney through a prompt generated by a Nano B https://user-images.githubusercontent.com/113217272/237840989-1e29a5cc-6644-48d0-87b4-62798dc6ebd3.mp4 - [Setup](#setup) + - [Docker](#docker) - [Usage](#usage) - [Command Line](#command-line) - [Library](#library) @@ -46,6 +47,43 @@ export NANO_BOTS_CARTRIDGES_DIRECTORY=/home/user/.local/share/nano-bots/cartridg Alternatively, if your current directory has a `.env` file with the environment variables, they will be automatically loaded. +## Docker + +Clone the repository and copy the Docker Compose template: + +``` +git clone git@github.com:icebaker/ruby-nano-bots.git +cd ruby-nano-bots +cp docker-compose.example.yml docker-compose.yml +``` + +Set your provider credentials and choose your desired directory for the cartridges files: + +```yaml +version: '3.7' + +services: + nano-bots: + image: ruby:3.2.2-slim-bullseye + command: sh -c "gem install nano-bots -v 0.0.1 && bash" + environment: + OPENAI_API_ADDRESS: https://api.openai.com + OPENAI_API_ACCESS_TOKEN: your-token + OPENAI_API_USER_IDENTIFIER: your-user + volumes: + - ./your-cartridges:/cartridges +``` + +Enter the container: +```sh +docker compose run nano-bots +``` + +Start playing: +```sh +rnb cartridges/assistant.yml - repl +``` + ## Usage ### Command Line diff --git a/docker-compose.example.yml b/docker-compose.example.yml new file mode 100644 index 0000000..0129c74 --- /dev/null +++ b/docker-compose.example.yml @@ -0,0 +1,12 @@ +version: '3.7' + +services: + nano-bots: + image: ruby:3.2.2-slim-bullseye + command: sh -c "gem install nano-bots -v 0.0.1 && bash" + environment: + OPENAI_API_ADDRESS: https://api.openai.com + OPENAI_API_ACCESS_TOKEN: your-token + OPENAI_API_USER_IDENTIFIER: your-user + volumes: + - ./your-cartridges:/cartridges -- cgit v1.2.3