mirror of
https://github.com/alfem/telegram-download-daemon.git
synced 2025-03-01 08:33:11 +08:00
The python version is updated from 3.6 to 3.9 because version 3.6 is no longer officially maintained on dockerhub. The previous image was built on the full python image which caused the final size to be bloates, this commit builds the image in layers, first in the full python image so it can build the pip packages and then copies what was installed with pip to a slim python image which considerably reduces the size of the final image.
20 lines
519 B
Docker
20 lines
519 B
Docker
FROM python:3.9-bullseye AS compile-image
|
|
|
|
RUN echo $TARGETPLATFORM
|
|
RUN if [ "$TARGETPLATFORM" = "linux/arm/v7" ]; then \
|
|
which lsb_release \
|
|
lsb_release -a \
|
|
mv /usr/bin/lsb_release /usr/bin/lsb_release.bak \
|
|
pip install --no-cache-dir --user telethon; \
|
|
else \
|
|
pip install --no-cache-dir --user telethon cryptg; \
|
|
fi
|
|
|
|
FROM python:3.9-slim-bullseye AS run-image
|
|
|
|
COPY --from=compile-image /root/.local /root/.local
|
|
|
|
WORKDIR /app
|
|
COPY *.py ./
|
|
|
|
CMD [ "python3", "./telegram-download-daemon.py" ]
|