From 5fb14bd205250e89f8f729109b5fcae591790002 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 9 Apr 2023 20:29:08 +0500 Subject: [PATCH 1/7] docker to use .env --- README.md | 2 +- docker-compose.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ab7f57a..b93aa66 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A Telegram bot that lets you interact with the Bing AI from chats that you allow **> To start using this project using Docker,** - Run `docker compose -f .build/docker-compose.yml build` to build the container -- TODO +- Create a `.env` file or set environment variables according to the reference file `.env.example` - Run `docker compose up -d` to start the bot. **> To enable Telegram command autocompletion,** diff --git a/docker-compose.yml b/docker-compose.yml index 7975f9d..1d33042 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,6 +3,6 @@ services: ######################### bing-tg: hostname: bing-tg - image: bing-tg - volumes: - - ./variables.ts:/root/variables.ts + image: git.shihaam.dev/dockerfiles/bing-chat-telegram + env_file: + - .env From 44e359e176c4e9695b7e4ff5829cfae1125a98b8 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 9 Apr 2023 20:30:18 +0500 Subject: [PATCH 2/7] corrected image path --- .build/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.build/docker-compose.yml b/.build/docker-compose.yml index b1c1531..5299b53 100644 --- a/.build/docker-compose.yml +++ b/.build/docker-compose.yml @@ -6,4 +6,4 @@ services: context: .. dockerfile: .build/Dockerfile hostname: bing-tg - image: bing-tg + image: git.shihaam.dev/dockerfiles/bing-chat-telegram From b9098834227a7b0561a4e97b55f8d8a3dca90c70 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 9 Apr 2023 20:31:53 +0500 Subject: [PATCH 3/7] build and ready to start bot on container start.. --- .build/Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.build/Dockerfile b/.build/Dockerfile index a577290..630f59a 100644 --- a/.build/Dockerfile +++ b/.build/Dockerfile @@ -9,8 +9,7 @@ WORKDIR /root COPY . . RUN yarn install \ - && rm -rf /usr/local/share/.cache + && rm -rf /usr/local/share/.cache \ + && yarn build - #&& yarn build - -CMD yarn build && yarn start +CMD yarn start From a3e389c3901b568e99738f164a44a1c8738fa2bc Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 9 Apr 2023 20:49:56 +0500 Subject: [PATCH 4/7] clear cache when youre done with the thing --- .build/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.build/Dockerfile b/.build/Dockerfile index 630f59a..277a83a 100644 --- a/.build/Dockerfile +++ b/.build/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /root COPY . . RUN yarn install \ - && rm -rf /usr/local/share/.cache \ - && yarn build + && yarn build \ + && rm -rf /usr/local/share/.cache CMD yarn start From 4de1f643eb9862b39e88934a2ac827b7c38cff80 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 9 Apr 2023 21:05:20 +0500 Subject: [PATCH 5/7] added production and build instructions --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b93aa66..726bdb1 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,22 @@ A Telegram bot that lets you interact with the Bing AI from chats that you allow in the config. **> To start using this project,** - +- Git clone and cd into cloned dir - Run `yarn install` to install the dependencies. - Create a `.env` file or set environment variables according to the reference file `.env.example` - Run `yarn dev` or `yarn build && yarn start` to start the bot. **> To start using this project using Docker,** - -- Run `docker compose -f .build/docker-compose.yml build` to build the container +- Git clone and cd into cloned dir +- Run `docker compose -f .build/docker-compose.yml build` to build the container. - Create a `.env` file or set environment variables according to the reference file `.env.example` - Run `docker compose up -d` to start the bot. +- Run `docker compose -f .build/docker-compose.yml push` to push container to registry. + +**> To start using this project using Docker in prod** +- Create `docker-compose.yml` with the content from `docker-compose.yml` in repo. +- Create `.env` with the required variables. (see .env.example in repo) +- Run `docker compose up -d` to start the bot. **> To enable Telegram command autocompletion,** From 6730d36ef29ded8540afd8b49390f08921062c51 Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 9 Apr 2023 21:07:48 +0500 Subject: [PATCH 6/7] added auto restart if crash --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index 1d33042..c2bff65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,3 +6,4 @@ services: image: git.shihaam.dev/dockerfiles/bing-chat-telegram env_file: - .env + restart: always From cadcd57fc17ce6b9a0d3cc0730772c1513bc34ce Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Sun, 9 Apr 2023 21:12:37 +0500 Subject: [PATCH 7/7] follow udit standard --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 726bdb1..be67c7e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A Telegram bot that lets you interact with the Bing AI from chats that you allow - Run `docker compose up -d` to start the bot. - Run `docker compose -f .build/docker-compose.yml push` to push container to registry. -**> To start using this project using Docker in prod** +**> To start using this project using Docker in prod,** - Create `docker-compose.yml` with the content from `docker-compose.yml` in repo. - Create `.env` with the required variables. (see .env.example in repo) - Run `docker compose up -d` to start the bot.