Skip to content

Commit

Permalink
Fixes to build for Ubuntu 24.04 and slim for python up to python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
mauvilsa committed Oct 22, 2024
1 parent b64284d commit 2a390e9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 32 deletions.
5 changes: 5 additions & 0 deletions py-pagexml/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ Normal (in addition to the previous):
- libopencv-imgproc4.5d
- libopencv-core4.5d
- libgdal30
- Ubuntu 24.04
- libopencv-imgcodecs406t64
- libopencv-imgproc406t64
- libopencv-core406t64
- libgdal34t64

Building dependencies
~~~~~~~~~~~~~~~~~~~~~
Expand Down
7 changes: 3 additions & 4 deletions py-pagexml/docker/Dockerfile_build
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,11 @@ RUN apt-get update --fix-missing \
&& if [ -f /usr/lib/x86_64-linux-gnu/pkgconfig/opencv4.pc ]; then \
ln -s opencv4.pc /usr/lib/x86_64-linux-gnu/pkgconfig/opencv.pc; \
fi \
&& pip3 install --upgrade pip setuptools \
&& apt-get autoremove -y \
&& apt-get purge -y $(dpkg -l | awk '{if($1=="rc")print $2}') \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

#RUN useradd -m -u 1234 pagexml-build
#WORKDIR /home/pagexml-build
#USER 1234
RUN useradd -m -u 1234 pagexml-build
WORKDIR /home/pagexml-build
USER 1234
23 changes: 23 additions & 0 deletions py-pagexml/docker/Dockerfile_build_manylinux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

WD=$(cd .. && pwd)
IMAGE=quay.io/pypa/manylinux_2_28_x86_64:latest
PY=313

docker run \
--rm \
-t \
--env HOME=/tmp \
--user $(id -u):$(id -g) \
--workdir "$WD" \
--volume $HOME:$HOME \
--entrypoint bash \
$IMAGE \
-c "
set -e
/opt/python/cp$PY-cp$PY/bin/pip install setuptools pkgconfig
/opt/python/cp$PY-cp$PY/bin/python setup.py bdist_wheel --slim
auditwheel repair dist/pagexml_slim-*-cp$PY-cp$PY-linux_x86_64.whl
/opt/python/cp$PY-cp$PY/bin/pip install wheelhouse/pagexml_slim-*-cp$PY-cp$PY-manylinux*.whl
/opt/python/cp$PY-cp$PY/bin/python -m pagexml_tests
"
27 changes: 12 additions & 15 deletions py-pagexml/docker/Dockerfile_runtime
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,18 @@ ENV \
LC_ALL=C.UTF-8


ARG PYTHON_VERSION=3

RUN if ! test -n "$PYTHON_VERSION"; then \
echo "error: PYTHON_VERSION argument is required"; \
exit 1; \
fi \
&& . /etc/os-release \
&& if [ "$VERSION_ID" = "20.04" ] && [ "$PYTHON_VERSION" = "3" ]; then \
RUN . /etc/os-release \
&& if [ "$VERSION_ID" = "20.04" ]; then \
CV_VERSION=4.2; \
GDAL_VERSION=26; \
elif [ "$VERSION_ID" = "22.04" ] && [ "$PYTHON_VERSION" = "3" ]; then \
elif [ "$VERSION_ID" = "22.04" ]; then \
CV_VERSION=4.5d; \
GDAL_VERSION=30; \
elif [ "$VERSION_ID" = "24.04" ]; then \
CV_VERSION=406t64; \
GDAL_VERSION=34t64; \
else \
echo "error: unsupported combination UBUNTU=$VERSION_ID PYTHON=$PYTHON_VERSION"; \
echo "error: unsupported UBUNTU=$VERSION_ID"; \
exit 1; \
fi \
&& apt-get update --fix-missing \
Expand All @@ -34,16 +31,15 @@ RUN if ! test -n "$PYTHON_VERSION"; then \
nano \
curl \
ca-certificates \
python$PYTHON_VERSION \
python$PYTHON_VERSION-pip \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
virtualenv \
libopencv-imgproc$CV_VERSION \
libopencv-imgcodecs$CV_VERSION \
libopencv-core$CV_VERSION \
libgdal$GDAL_VERSION \
&& pip3 install --upgrade pip setuptools wheel \
&& apt-get purge -y \
python$PYTHON_VERSION-pip \
&& apt-get autoremove -y \
&& apt-get purge -y $(dpkg -l | awk '{if($1=="rc")print $2}') \
&& apt-get clean \
Expand All @@ -59,6 +55,7 @@ RUN if ! test -n "$PAGEXML_VERSION"; then \
&& pip3 install \
--no-cache-dir \
--root-user-action=ignore \
--break-system-packages \
--progress-bar=off \
--index-url=https://pypi.omnius.com \
--trusted-host=pypi.omnius.com \
Expand Down
19 changes: 6 additions & 13 deletions py-pagexml/docker/Dockerfile_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,21 @@ PAGEXML_VERSION=2022.04.12

docker build \
-f Dockerfile_runtime \
-t mauvilsa/pagexml:runtime-ubuntu16.04-py35 \
--build-arg UBUNTU_TAG=16.04 \
--build-arg PAGEXML_VERSION=$PAGEXML_VERSION \
.

docker build \
-f Dockerfile_runtime \
-t mauvilsa/pagexml:runtime-ubuntu18.04-py36 \
--build-arg UBUNTU_TAG=18.04 \
-t mauvilsa/pagexml:runtime-ubuntu20.04-py38 \
--build-arg UBUNTU_TAG=20.04 \
--build-arg PAGEXML_VERSION=$PAGEXML_VERSION \
.

docker build \
-f Dockerfile_runtime \
-t mauvilsa/pagexml:runtime-ubuntu20.04-py38 \
--build-arg UBUNTU_TAG=20.04 \
-t mauvilsa/pagexml:runtime-ubuntu22.04-py310 \
--build-arg UBUNTU_TAG=22.04 \
--build-arg PAGEXML_VERSION=$PAGEXML_VERSION \
.

docker build \
-f Dockerfile_runtime \
-t mauvilsa/pagexml:runtime-ubuntu22.04-py310 \
--build-arg UBUNTU_TAG=22.04 \
-t mauvilsa/pagexml:runtime-ubuntu24.04-py312 \
--build-arg UBUNTU_TAG=24.04 \
--build-arg PAGEXML_VERSION=$PAGEXML_VERSION \
.

0 comments on commit 2a390e9

Please sign in to comment.