diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..40ea08b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM node:lts + +ENV KINDROID_INFER_URL="https://api.kindroid.ai/v1/discord-bot" + +RUN mkdir -p /home/node/kindroid/src +WORKDIR /home/node/kindroid/ + +COPY package*.json . +RUN npm install + +COPY . . +RUN chown -R node:node /home/node/kindroid/ +USER node + +CMD ["npm","start"] \ No newline at end of file diff --git a/README.md b/README.md index f969ed3..70d3088 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,55 @@ A Node.js service that manages multiple Discord bots, each tied to a unique Kind npm start ``` +# Docker version (production) + +1. **Clone the repository** + + ```bash + git clone https://github.com/KindroidAI/Kindroid-discord.git + cd Kindroid-discord + ``` + +2. **Build the image** + + ```bash + docker build -t kindroid-bot . + ``` + +3. **Run the image with environment variables** + + ```bash + docker run -d -e KINDROID_API_KEY=your_kindroid_api_key_here -e SHARED_AI_CODE_1=your_shared_code_1_here -e BOT_TOKEN_1=your_discord_bot_token_1_here -e ENABLE_FILTER_1=false kindroid-bot:latest + ``` + If you have a .env file + + ```bash + docker run -d --env-file path_to_env_file kindroid-bot:latest + ``` + + Or create a compose file + + ```bash + touch compose.yml + ``` + + ```yaml + services: + discord: + image: kindroid-bot + container_name: container_name + restart: always + environment: + KINDROID_API_KEY: your_kindroid_api_key_here + SHARED_AI_CODE_1: your_shared_code_1_here + BOT_TOKEN_1: your_discord_bot_token_1_here + ENABLE_FILTER_1: false + ``` + + ```bash + docker compose up + ``` + ## Configuration Use environment variables to configure your bots. The .env.example file shows usage: diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..bd34bf5 --- /dev/null +++ b/compose.yaml @@ -0,0 +1,10 @@ +services: + discord: + image: kindroid-bot:latest + container_name: container_name + restart: on-failure:5 + environment: + KINDROID_API_KEY: your_kindroid_api_key_here + SHARED_AI_CODE_1: your_shared_code_1_here + BOT_TOKEN_1: your_discord_bot_token_1_here + ENABLE_FILTER_1: false \ No newline at end of file