-
Notifications
You must be signed in to change notification settings - Fork 81
/
Dockerfile.memebot
56 lines (40 loc) · 1.6 KB
/
Dockerfile.memebot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
FROM python:3.10 as tmp
WORKDIR /tmp
RUN curl -sSL https://install.python-poetry.org | python -
ENV PATH="${PATH}:/root/.local/bin"
COPY ./pyproject.toml ./poetry.lock* /tmp/
RUN apt-get update \
&& apt-get install -y --no-install-recommends git \
&& poetry export -f requirements.txt --output requirements.txt --without-hashes \
&& git clone --depth=1 https://github.com/MeetWq/github-meme-bot
FROM python:3.10-slim as app
WORKDIR /app
EXPOSE 2233
VOLUME /data
ENV TZ=Asia/Shanghai \
LOAD_BUILTIN_MEMES=true \
MEME_DIRS="[\"/data/memes\"]" \
MEME_DISABLED_LIST="[]" \
GIF_MAX_SIZE=10.0 \
GIF_MAX_FRAMES=100 \
BAIDU_TRANS_APPID="" \
BAIDU_TRANS_APIKEY="" \
LOG_LEVEL="INFO"
COPY --from=tmp /tmp/requirements.txt /app/requirements.txt
COPY --from=tmp /tmp/github-meme-bot/src /app/src
COPY --from=tmp /tmp/github-meme-bot/bot.py /app/bot.py
COPY --from=tmp /tmp/github-meme-bot/.env /app/.env
COPY ./resources/fonts/* /usr/share/fonts/meme-fonts/
RUN apt-get update \
&& apt-get install -y --no-install-recommends fontconfig fonts-noto-color-emoji libgl1-mesa-glx libgl1-mesa-dri gettext \
&& fc-cache -fv \
&& apt-get purge -y --auto-remove \
&& rm -rf /var/lib/apt/lists/* \
&& pip install --no-cache-dir --upgrade -r /app/requirements.txt \
&& pip install --no-cache-dir --upgrade nonebot2 nonebot-adapter-github nonebot-plugin-alconna
COPY ./meme_generator /app/meme_generator
COPY ./docker/config.toml.template /app/config.toml.template
COPY ./docker/start_memebot.sh /app/start_memebot.sh
RUN chmod +x /app/start_memebot.sh
RUN python -m meme_generator.cli
CMD ["/app/start_memebot.sh"]