Skip to content

Commit

Permalink
Fixed duckduckgo search
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronJGrant committed Dec 24, 2023
1 parent 4162f8e commit 619421e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
FROM lwthiker/curl-impersonate:0.5-chrome-alpine AS builder

This comment has been minimized.

Copy link
@CameronJGrant

CameronJGrant Dec 26, 2023

Author

We can copy over curl-impersonate binaries from this image.


FROM python:3.9-alpine

ENV PYTHONFAULTHANDLER=1 \
PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_DISABLE_PIP_VERSION_CHECK=on

RUN apk --no-cache add ffmpeg
COPY --from=builder /usr/local /usr/local

RUN apk --no-cache add ffmpeg build-base nss ca-certificates

WORKDIR /app
COPY . .
RUN pip install -r requirements.txt --no-cache-dir

RUN apk del build-base

This comment has been minimized.

Copy link
@CameronJGrant

CameronJGrant Dec 26, 2023

Author

We need gcc from build-base to build the curl-cffi package. After that we can remove it to keep the image minimal.


RUN ln -s /etc/ssl/certs/ca-certificates.crt /usr/local/lib/python3.9/site-packages/curl_cffi/cacert.pem

This comment has been minimized.

Copy link
@CameronJGrant

CameronJGrant Dec 26, 2023

Author

curl-cffi doesn't look for certs properly so we have to link them to the python side-package. Oh well.


CMD ["python", "bot/main.py"]
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ python-telegram-bot==20.3
requests~=2.31.0
tenacity==8.2.2
wolframalpha~=5.0.0
duckduckgo_search~=3.8.3
duckduckgo_search~=4.1.0
spotipy~=2.23.0
pytube~=15.0.0
gtts~=2.3.2
whois~=0.9.27
Pillow~=10.1.0
curl-cffi~=0.5.10

This comment has been minimized.

Copy link
@CameronJGrant

CameronJGrant Dec 26, 2023

Author

This is needed for duckduckgo > 4.0.0

0 comments on commit 619421e

Please sign in to comment.