Skip to content

Commit b4d0e91

Browse files
author
Sebastian Plaza
committed
feat: add docker image
1 parent 8326b88 commit b4d0e91

File tree

5 files changed

+30
-1
lines changed

5 files changed

+30
-1
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: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1-alpine as builder
2+
RUN apk update && apk add gcc make g++ git
3+
WORKDIR /build
4+
ADD . .
5+
RUN make build
6+
7+
FROM alpine
8+
COPY --from=builder /build/chatgpt-telegram /bin/chatgpt-telegram
9+
RUN chmod +x /bin/chatgpt-telegram
10+
11+
ENTRYPOINT ["/bin/chatgpt-telegram"]

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ You will then have to create a config file in the following location depending o
3636
3737
Finally, add your cookie to the file and save it. It should look like this: `{ "openaisession": "YOUR_COOKIE_HERE" }`.
3838

39+
## Docker
40+
41+
It is also possible to launch the bot via the docker image included.
42+
43+
Check [docker-compose](./docker-compose.yml) file to understands how to do it.
44+
3945
## License
4046

4147
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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func main() {
4646

4747
err = godotenv.Load()
4848
if err != nil {
49-
log.Fatalf("Couldn't load .env file: %v", err)
49+
log.Printf("Couldn't load .env file: %v. Using shell exposed env variables...", err)
5050
}
5151

5252
bot, err := tgbotapi.NewBotAPI(os.Getenv("TELEGRAM_TOKEN"))

0 commit comments

Comments
 (0)