From 0f70c6ab63a8ca556cfed107bc30d85d9970fc81 Mon Sep 17 00:00:00 2001 From: Aleksandr Karpinskii Date: Fri, 16 Aug 2024 14:26:08 +0400 Subject: [PATCH] Dockerfile improvements: Fix docker image version Exclude outdated pp37 & pp38 Include cp312 & pp310 Upgrade X265, LIBDE265 & LIBAOM to latest versions Check actual libheif versions --- Dockerfile | 80 +++++++++++++++++++++++++++++++----------------------- Makefile | 16 +++++++++++ 2 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 Makefile diff --git a/Dockerfile b/Dockerfile index 9ab4155..2678510 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ ARG PLAT=manylinux2014_x86_64 -FROM quay.io/pypa/$PLAT AS base +FROM quay.io/pypa/$PLAT:2024.08.12-1 AS base ############### @@ -42,7 +42,7 @@ FROM build-tools AS build-deps # x265 RUN set -ex \ - && X265_VERSION="3.5" \ + && X265_VERSION="3.6" \ && curl -fLO https://bitbucket.org/multicoreware/x265_git/downloads/x265_${X265_VERSION}.tar.gz \ && tar xvf x265_${X265_VERSION}.tar.gz \ && cd x265_${X265_VERSION} \ @@ -52,7 +52,7 @@ RUN set -ex \ # libde265 RUN set -ex \ - && LIBDE265_VERSION="1.0.12" \ + && LIBDE265_VERSION="1.0.15" \ && curl -fLO https://github.com/strukturag/libde265/releases/download/v${LIBDE265_VERSION}/libde265-${LIBDE265_VERSION}.tar.gz \ && tar xvf libde265-${LIBDE265_VERSION}.tar.gz \ && cd libde265-${LIBDE265_VERSION} \ @@ -63,7 +63,7 @@ RUN set -ex \ # libaom RUN set -ex \ - && LIBAOM_VERSION="v3.6.1" \ + && LIBAOM_VERSION="v3.8.3" \ && mkdir -v aom && mkdir -v aom_build && cd aom \ && curl -fLO "https://aomedia.googlesource.com/aom/+archive/${LIBAOM_VERSION}.tar.gz" \ && tar xvf ${LIBAOM_VERSION}.tar.gz \ @@ -73,9 +73,16 @@ RUN set -ex \ && make -j $(nproc) && make install && ldconfig \ && rm -rf /build -# libheif +################## +# libheif 1.18.2 # +################## + +FROM build-deps AS libheif +ARG LIBHEIF_VERSION=1.18.2 +ARG PLAT + RUN set -ex \ - && LIBHEIF_VERSION="1.16.2" \ + && LIBHEIF_VERSION="$LIBHEIF_VERSION" \ && curl -fLO https://github.com/strukturag/libheif/releases/download/v${LIBHEIF_VERSION}/libheif-${LIBHEIF_VERSION}.tar.gz \ && tar xvf libheif-${LIBHEIF_VERSION}.tar.gz && mv libheif-${LIBHEIF_VERSION} libheif \ && mkdir libheif_build && cd libheif_build \ @@ -83,12 +90,21 @@ RUN set -ex \ && make -j $(nproc) && make install && ldconfig \ && rm -rf /build +COPY ./ /pyheif + +RUN set -ex \ + && PNV="/opt/python/cp310-cp310/bin" \ + && $PNV/pip wheel /pyheif \ + && auditwheel repair pyheif*.whl --plat $PLAT -w /wheelhouse \ + && $PNV/pip install --only-binary pillow==10.4.0 -r /pyheif/requirements-test.txt \ + && $PNV/pip install /wheelhouse/*-cp310-*.whl \ + && cd /pyheif && $PNV/pytest ########################## # Build manylinux wheels # ########################## -FROM build-deps AS repaired +FROM libheif AS all-pythons-repaired ARG PLAT COPY ./ /pyheif @@ -98,9 +114,9 @@ RUN /opt/python/cp38-cp38/bin/pip wheel /pyheif RUN /opt/python/cp39-cp39/bin/pip wheel /pyheif RUN /opt/python/cp310-cp310/bin/pip wheel /pyheif RUN /opt/python/cp311-cp311/bin/pip wheel /pyheif -RUN /opt/python/pp37-pypy37_pp73/bin/pip wheel /pyheif -RUN /opt/python/pp38-pypy38_pp73/bin/pip wheel /pyheif +RUN /opt/python/cp312-cp312/bin/pip wheel /pyheif RUN /opt/python/pp39-pypy39_pp73/bin/pip wheel /pyheif +RUN /opt/python/pp310-pypy310_pp73/bin/pip wheel /pyheif RUN auditwheel repair pyheif*.whl --plat $PLAT -w /wheelhouse @@ -109,23 +125,19 @@ RUN auditwheel repair pyheif*.whl --plat $PLAT -w /wheelhouse ############### FROM base AS tested -ARG PLAT COPY ./requirements-test.txt /tmp/requirements-test.txt -RUN /opt/python/cp37-cp37m/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt -RUN /opt/python/cp38-cp38/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt -RUN /opt/python/cp39-cp39/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt -RUN /opt/python/cp310-cp310/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt -RUN /opt/python/cp311-cp311/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt -RUN if [ "$PLAT" != "manylinux2014_aarch64" ]; then \ - /opt/python/pp37-pypy37_pp73/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt ; fi -RUN if [ "$PLAT" != "manylinux2014_aarch64" ]; then \ - /opt/python/pp38-pypy38_pp73/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt ; fi -RUN if [ "$PLAT" != "manylinux2014_aarch64" ]; then \ - /opt/python/pp39-pypy39_pp73/bin/pip install --only-binary pillow -r /tmp/requirements-test.txt ; fi - -COPY --from=repaired /wheelhouse /wheelhouse +RUN /opt/python/cp37-cp37m/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt +RUN /opt/python/cp38-cp38/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt +RUN /opt/python/cp39-cp39/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt +RUN /opt/python/cp310-cp310/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt +RUN /opt/python/cp311-cp311/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt +RUN /opt/python/cp312-cp312/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt +RUN /opt/python/pp39-pypy39_pp73/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt +RUN /opt/python/pp310-pypy310_pp73/bin/pip install --only-binary pillow==10.4.0 -r /tmp/requirements-test.txt + +COPY --from=all-pythons-repaired /wheelhouse /wheelhouse COPY ./ /pyheif WORKDIR /pyheif @@ -154,21 +166,21 @@ RUN set -ex \ && PNV="/opt/python/cp311-cp311/bin" \ && $PNV/pip install /wheelhouse/*-cp311-*.whl \ && $PNV/pytest -# pypy 3.7 +# python 3.12 RUN set -ex \ - && PNV="/opt/python/pp37-pypy37_pp73/bin/" \ - && $PNV/pip install /wheelhouse/*-pp37-*.whl \ - && if [ "$PLAT" != "manylinux2014_aarch64" ]; then $PNV/pytest ; fi -# pypy 3.8 -RUN set -ex \ - && PNV="/opt/python/pp38-pypy38_pp73/bin/" \ - && $PNV/pip install /wheelhouse/*-pp38-*.whl \ - && if [ "$PLAT" != "manylinux2014_aarch64" ]; then $PNV/pytest ; fi + && PNV="/opt/python/cp312-cp312/bin" \ + && $PNV/pip install /wheelhouse/*-cp312-*.whl \ + && $PNV/pytest # pypy 3.9 RUN set -ex \ - && PNV="/opt/python/pp39-pypy39_pp73/bin/" \ + && PNV="/opt/python/pp39-pypy39_pp73/bin" \ && $PNV/pip install /wheelhouse/*-pp39-*.whl \ - && if [ "$PLAT" != "manylinux2014_aarch64" ]; then $PNV/pytest ; fi + && $PNV/pytest +# pypy 3.10 +RUN set -ex \ + && PNV="/opt/python/pp310-pypy310_pp73/bin" \ + && $PNV/pip install /wheelhouse/*-pp310-*.whl \ + && $PNV/pytest ################# diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..5cd19f8 --- /dev/null +++ b/Makefile @@ -0,0 +1,16 @@ +.PHONY: check_libheif_versions + +PLAT ?= manylinux2014_x86_64 + +check_libheif_versions: + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.16.1 . + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.16.2 . + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.17.0 . + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.17.5 . + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.17.6 . + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.18.0 . + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.18.1 . + docker build --target=libheif --build-arg=PLAT=${PLAT} --build-arg=LIBHEIF_VERSION=1.18.2 . + +test: + docker build --target=tested --build-arg=PLAT=${PLAT} .