telegram-download-daemon/Dockerfile
ksobrenat32 8cea69d8ba
Optimize docker image and Move from Python 3.6 to 3.9
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.
2022-04-28 18:12:52 -05:00

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" ]