Skip to content

Commit

Permalink
Introduce multi-stage build in Docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
yym68686 committed Nov 21, 2023
1 parent ffef73b commit 9ccc598
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
14 changes: 9 additions & 5 deletions Dockerfile.build
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
FROM python:3.10.13
WORKDIR /home
FROM python:3.10.13 AS builder
COPY ./requirements.txt /home
RUN pip install -r /home/requirements.txt

FROM python:3.10.13-slim-bullseye
EXPOSE 8080
WORKDIR /home
COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages
COPY ./setup.sh /home
COPY ./requirements.txt /home
RUN apt-get update && apt-get install -y git \
&& rm -rf /var/lib/apt/lists/* && pip install -r /home/requirements.txt
RUN apt-get update && apt-get install -y --no-install-recommends git \
&& rm -rf /var/lib/apt/lists/* /tmp/*
ENTRYPOINT ["/home/setup.sh"]
3 changes: 3 additions & 0 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,9 @@ async def post_init(application: Application) -> None:
ApplicationBuilder()
.token(BOT_TOKEN)
.concurrent_updates(True)
.read_timeout(10)
.connection_pool_size(50000)
.pool_timeout(1200.0)
.rate_limiter(AIORateLimiter(max_retries=5))
.post_init(post_init)
.build()
Expand Down
5 changes: 2 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ wikipedia
fake_useragent
openai==0.28.1
google-api-python-client
unstructured[md]
unstructured[pdf]
unstructured[md,pdf]
duckduckgo-search==3.8.5
langchain==0.0.271
oauth2client==3.0.0
g4f==0.1.8.7
g4f==0.1.8.8
1 change: 0 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/bin/bash
set -eu
rm -rf ChatGPT-Telegram-Bot/
git clone --depth 1 -b main https://github.com/yym68686/ChatGPT-Telegram-Bot.git
python -u /home/ChatGPT-Telegram-Bot/bot.py

0 comments on commit 9ccc598

Please sign in to comment.