Skip to content

Commit 47e75ec

Browse files
Sebastian Plazaskrashevich
authored andcommitted
feat: add docker image
1 parent 9d23a22 commit 47e75ec

File tree

5 files changed

+20
-5
lines changed

5 files changed

+20
-5
lines changed

.config/chatgpt.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"openaisession": "YOUR_COOKIE_HERE"
3+
}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
FROM golang:1-alpine as builder
2-
RUN apk update && apk add make
2+
RUN apk update && apk add gcc make g++ git
33
WORKDIR /build
44
ADD . .
55
RUN make build

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ You will then have to create a config file in the following location depending o
6767

6868
Finally, add your cookie to the file and save it. It should look like this: `{ "openaisession": "YOUR_COOKIE_HERE" }`.
6969

70+
## Docker
71+
72+
It is also possible to launch the bot via the docker image included.
73+
74+
Check [docker-compose](./docker-compose.yml) file to understands how to do it.
75+
7076
## License
7177

7278
This repository is licensed under the [MIT License](LICENSE).

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
chatgpt-telegram:
3+
build: .
4+
container_name: chatgpt-telegram
5+
volumes:
6+
- .config/:/root/.config
7+
environment:
8+
- TELEGRAM_ID=
9+
- TELEGRAM_TOKEN=

main.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@ func main() {
3636

3737
envConfig, err := config.LoadEnvConfig(".env")
3838
if err != nil {
39-
log.Fatalf("Couldn't load .env config: %v", err)
40-
}
41-
if err := envConfig.ValidateWithDefaults(); err != nil {
42-
log.Fatalf("Invalid .env config: %v", err)
39+
log.Printf("Couldn't load .env file: %v. Using shell exposed env variables...", err)
4340
}
4441

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

0 commit comments

Comments
 (0)