From a337aeb7cdfb25c3bb6f7834c6ab6ddddf6c5341 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Wed, 8 Jan 2025 18:42:21 +0100 Subject: [PATCH] Dockerfile.alpine as improved Dockerfile - Only 25% of the size of the original one - Uses official Python base image - Python 3.12 (compromise between stability and new features) - Alpine 3.20 (also stability / feature compromise) - All buildtools are removed after building --- docker/Dockerfile.alpine | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docker/Dockerfile.alpine diff --git a/docker/Dockerfile.alpine b/docker/Dockerfile.alpine new file mode 100644 index 0000000..06b1bac --- /dev/null +++ b/docker/Dockerfile.alpine @@ -0,0 +1,20 @@ +FROM python:3.12-alpine3.20 +ARG NEEDED_PACKAGES_FOR_BUILD="olm-dev jpeg-dev cmake make gcc g++" + +RUN mkdir -p /app/matrix_commander/ + +WORKDIR /app/ +COPY requirements.txt . +RUN apk add --no-cache ${NEEDED_PACKAGES_FOR_BUILD} && \ + pip3 install --no-cache -r requirements.txt && \ + apk del --purge ${NEEDED_PACKAGES_FOR_BUILD} +RUN apk add --no-cache libjpeg olm libmagic + +WORKDIR /app/matrix_commander/ +COPY matrix_commander/matrix_commander.py . +COPY matrix_commander/matrix-commander . +COPY matrix_commander/__init__.py . + +VOLUME /data + +ENTRYPOINT ["python3", "/app/matrix_commander/matrix-commander" ,"-s", "/data/store", "-c", "/data/credentials.json"]