From 8a255d41af1399a761ae363d1d5effbe1240e546 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sat, 8 Apr 2023 16:08:49 +0500 Subject: [PATCH] added docker support --- .build/Dockerfile | 16 ++++++++++++++++ .build/docker-compose.yml | 9 +++++++++ README.md | 7 +++++++ docker-compose.yml | 8 ++++++++ 4 files changed, 40 insertions(+) create mode 100644 .build/Dockerfile create mode 100644 .build/docker-compose.yml create mode 100644 docker-compose.yml diff --git a/.build/Dockerfile b/.build/Dockerfile new file mode 100644 index 0000000..a577290 --- /dev/null +++ b/.build/Dockerfile @@ -0,0 +1,16 @@ +FROM node:18.15.0-alpine3.17 + + +# Set build shell to bash, default has has some issues sometimes +#SHELL ["/bin/bash", "-c"] + + +WORKDIR /root +COPY . . + +RUN yarn install \ + && rm -rf /usr/local/share/.cache + + #&& yarn build + +CMD yarn build && yarn start diff --git a/.build/docker-compose.yml b/.build/docker-compose.yml new file mode 100644 index 0000000..b1c1531 --- /dev/null +++ b/.build/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.5' +services: +######################### + bing-tg: + build: + context: .. + dockerfile: .build/Dockerfile + hostname: bing-tg + image: bing-tg diff --git a/README.md b/README.md index 64a554b..526b96c 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,13 @@ A Telegram bot that lets you interact with the Bing AI from chats that you allow * Copy `variables.example.ts` to `variables.ts`, go through it, and add the required information. * Run `yarn dev` or `yarn build && yarn start` to start the bot. +### OR using docker +**> To start using this project,** + +* Run `docker compose -f .build/docker-compose.yml build` to build the container +* Copy `variables.example.ts` to `variables.ts`, go through it, and add the required information. +* Run `docker compose up -d` to start the bot. + **> To enable Telegram command autocompletion,** * Press the `Edit Commands` button in your bot's menu on BotFather, and paste the following: ``` diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7975f9d --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +version: '3.5' +services: +######################### + bing-tg: + hostname: bing-tg + image: bing-tg + volumes: + - ./variables.ts:/root/variables.ts