Skip to content

Commit

Permalink
feat: add docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Plaza authored and skrashevich committed Dec 12, 2022
1 parent 9d23a22 commit 47e75ec
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .config/chatgpt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"openaisession": "YOUR_COOKIE_HERE"
}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM golang:1-alpine as builder
RUN apk update && apk add make
RUN apk update && apk add gcc make g++ git
WORKDIR /build
ADD . .
RUN make build
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ You will then have to create a config file in the following location depending o
Finally, add your cookie to the file and save it. It should look like this: `{ "openaisession": "YOUR_COOKIE_HERE" }`.

## Docker

It is also possible to launch the bot via the docker image included.

Check [docker-compose](./docker-compose.yml) file to understands how to do it.

## License

This repository is licensed under the [MIT License](LICENSE).
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
chatgpt-telegram:
build: .
container_name: chatgpt-telegram
volumes:
- .config/:/root/.config
environment:
- TELEGRAM_ID=
- TELEGRAM_TOKEN=
5 changes: 1 addition & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@ func main() {

envConfig, err := config.LoadEnvConfig(".env")
if err != nil {
log.Fatalf("Couldn't load .env config: %v", err)
}
if err := envConfig.ValidateWithDefaults(); err != nil {
log.Fatalf("Invalid .env config: %v", err)
log.Printf("Couldn't load .env file: %v. Using shell exposed env variables...", err)
}

bot, err := tgbot.New(envConfig.TelegramToken, time.Duration(envConfig.EditWaitSeconds))
Expand Down

0 comments on commit 47e75ec

Please sign in to comment.