mirror of
https://github.com/IRBorisov/ConceptCore.git
synced 2025-06-25 16:50:36 +03:00
Setup manylinux docker build for package
This commit is contained in:
parent
a91ff72a4f
commit
173e38f052
|
@ -6,10 +6,6 @@ set -u # Treat unset variables as an error when substituting.
|
||||||
|
|
||||||
export CMAKE_BUILD_TYPE="Release"
|
export CMAKE_BUILD_TYPE="Release"
|
||||||
|
|
||||||
# Choose between clang/clang++ or gcc/g++
|
|
||||||
export CC="gcc"
|
|
||||||
export CXX="g++"
|
|
||||||
|
|
||||||
# Build CCL
|
# Build CCL
|
||||||
cd /home/ccl
|
cd /home/ccl
|
||||||
conan profile detect --force
|
conan profile detect --force
|
||||||
|
|
101
Dockerfile
101
Dockerfile
|
@ -1,94 +1,49 @@
|
||||||
# ubunutu is the base image
|
# ubunutu is the base image
|
||||||
FROM ubuntu:jammy as cpp-builder
|
FROM quay.io/pypa/manylinux_2_28_x86_64 as builder
|
||||||
LABEL version="1.0"
|
LABEL version="1.0"
|
||||||
LABEL maintainer="IRBorisov iborisov@acconcept.ru"
|
LABEL maintainer="IRBorisov iborisov@acconcept.ru"
|
||||||
LABEL description="Linux build environment"
|
LABEL description="Linux build environment"
|
||||||
|
|
||||||
ARG LINUX_FLAVOR=ubuntu
|
|
||||||
ARG LINUX_DISTR=jammy
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# Install standard packages
|
# Install standard packages
|
||||||
RUN apt-get update -qq && \
|
RUN dnf update && \
|
||||||
apt-get full-upgrade -y && \
|
dnf upgrade -y && \
|
||||||
apt-get install -y --no-install-recommends \
|
dnf install -y \
|
||||||
nano \
|
nano \
|
||||||
|
make \
|
||||||
wget \
|
wget \
|
||||||
curl \
|
curl \
|
||||||
tar \
|
tar && \
|
||||||
unzip \
|
dnf update -y && \
|
||||||
git \
|
dnf clean all
|
||||||
software-properties-common \
|
|
||||||
build-essential \
|
|
||||||
gpg-agent && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install Python and Conan
|
# GCC compiler
|
||||||
RUN add-apt-repository -y ppa:deadsnakes/ppa && \
|
|
||||||
apt-get update -qq && \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
python3.12 \
|
|
||||||
python3.12-venv \
|
|
||||||
python3.12-dev && \
|
|
||||||
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12 && \
|
|
||||||
python3.12 -m pip install --upgrade pip setuptools && \
|
|
||||||
python3.12 -m pip install conan && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Add GCC compiler
|
|
||||||
ARG GCC_VER="13"
|
ARG GCC_VER="13"
|
||||||
RUN add-apt-repository -y ppa:ubuntu-toolchain-r/test && \
|
RUN dnf install -y \
|
||||||
apt-get update -qq && \
|
gcc-toolset-${GCC_VER} \
|
||||||
apt-get install -y --no-install-recommends \
|
gcc-toolset-${GCC_VER}-gcc-c++ && \
|
||||||
gcc-${GCC_VER} \
|
dnf remove -y gcc-toolset-12-* && \
|
||||||
g++-${GCC_VER} && \
|
dnf clean all
|
||||||
update-alternatives --install /usr/bin/gcc gcc $(which gcc-${GCC_VER}) 100 && \
|
|
||||||
update-alternatives --install /usr/bin/g++ g++ $(which g++-${GCC_VER}) 100 && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Add Clang compiler
|
ENV CC="/opt/rh/gcc-toolset-${GCC_VER}/root/bin/gcc"
|
||||||
ARG LLVM_VER="18"
|
ENV CXX="/opt/rh/gcc-toolset-${GCC_VER}/root/bin/g++"
|
||||||
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - 2>/dev/null
|
ENV PATH="/opt/python/cp312-cp312/bin:/opt/rh/gcc-toolset-13/root/bin:${PATH}"
|
||||||
RUN add-apt-repository -y "deb http://apt.llvm.org/${LINUX_DISTR}/ llvm-toolchain-${LINUX_DISTR}-${LLVM_VER} main" && \
|
|
||||||
apt-get update -qq && \
|
|
||||||
apt-get install -y --no-install-recommends \
|
|
||||||
clang-${LLVM_VER} \
|
|
||||||
clang-tools-${LLVM_VER} \
|
|
||||||
clangd-${LLVM_VER} \
|
|
||||||
lld-${LLVM_VER} \
|
|
||||||
lldb-${LLVM_VER} \
|
|
||||||
llvm-${LLVM_VER} \
|
|
||||||
llvm-${LLVM_VER}-dev \
|
|
||||||
llvm-${LLVM_VER}-runtime \
|
|
||||||
libc++-${LLVM_VER}-dev \
|
|
||||||
libc++abi-${LLVM_VER}-dev \
|
|
||||||
libclang-${LLVM_VER}-dev \
|
|
||||||
libclang-common-${LLVM_VER}-dev \
|
|
||||||
libfuzzer-${LLVM_VER}-dev \
|
|
||||||
clang-tidy-${LLVM_VER} && \
|
|
||||||
update-alternatives --install /usr/bin/clang clang $(which clang-${LLVM_VER}) 100 && \
|
|
||||||
update-alternatives --install /usr/bin/clang++ clang++ $(which clang++-${LLVM_VER}) 100 && \
|
|
||||||
update-alternatives --install /usr/bin/clang-tidy clang-tidy $(which clang-tidy-${LLVM_VER}) 1 && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Add CMake
|
# Install build tools
|
||||||
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null \
|
RUN python3.12 -m pip install \
|
||||||
| gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null && \
|
auditwheel \
|
||||||
apt-add-repository "deb https://apt.kitware.com/${LINUX_FLAVOR}/ ${LINUX_DISTR} main" && \
|
wheel \
|
||||||
apt-get update -qq && \
|
build \
|
||||||
apt-get install -y --no-install-recommends \
|
ninja \
|
||||||
cmake && \
|
cmake \
|
||||||
rm -rf /var/lib/apt/lists/*
|
conan
|
||||||
|
|
||||||
# Cleanup cached apt data we don't need anymore
|
|
||||||
RUN apt-get autoclean -y && \
|
|
||||||
apt-get autoremove -y && \
|
|
||||||
apt-get clean && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# ====================== END OF CPP-Python environment ==================
|
# ====================== END OF CPP-Python environment ==================
|
||||||
|
|
||||||
FROM cpp-builder as CCL
|
FROM builder as CCL
|
||||||
|
|
||||||
|
ENV TARGET_PLATFORM='manylinux_2_28_x86_64'
|
||||||
|
|
||||||
WORKDIR /home
|
WORKDIR /home
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
# Build script for Linux
|
# pyconcept Build script
|
||||||
set -e
|
# * using auditwheel to create standardazied packages
|
||||||
|
set -e # Exit immediately if a command exits with a non-zero status.
|
||||||
|
set -u # Treat unset variables as an error when substituting.
|
||||||
|
|
||||||
|
export CMAKE_BUILD_TYPE="Release"
|
||||||
|
|
||||||
packageName='pyconcept'
|
packageName='pyconcept'
|
||||||
output='../output/py'
|
output='../output/py'
|
||||||
pythonEnv='venv/bin/python3'
|
python='python3.12'
|
||||||
|
|
||||||
# Setup python env
|
# Setup python dependencies
|
||||||
python3.12 -m venv venv
|
${python} -m pip install -r requirements-build.txt
|
||||||
${pythonEnv} -m pip install -r requirements-build.txt
|
|
||||||
|
|
||||||
# Import sources from ccl
|
# Import sources from ccl
|
||||||
mkdir -p ccl
|
mkdir -p ccl
|
||||||
|
@ -17,16 +20,23 @@ cd ../pyconcept
|
||||||
|
|
||||||
# Build pyconcept
|
# Build pyconcept
|
||||||
rm -rf ${output}/${packageName}
|
rm -rf ${output}/${packageName}
|
||||||
${pythonEnv} -m build --no-isolation --wheel --outdir=${output}/${packageName}
|
# ${python} -m build --no-isolation --wheel --outdir=${output}/${packageName}
|
||||||
|
${python} -m pip wheel . -w "${output}/${packageName}"
|
||||||
|
wheel=$(find ${output}/${packageName} -name '*.whl')
|
||||||
|
|
||||||
|
auditwheel \
|
||||||
|
repair ${wheel} \
|
||||||
|
--plat "${TARGET_PLATFORM}" \
|
||||||
|
-w "${output}/${packageName}"
|
||||||
|
|
||||||
|
rm ${wheel}
|
||||||
wheel=$(find ${output}/${packageName} -name '*.whl')
|
wheel=$(find ${output}/${packageName} -name '*.whl')
|
||||||
|
|
||||||
# Test pyconcept
|
# Test pyconcept
|
||||||
${pythonEnv} -m pip uninstall -y ${packageName}
|
${python} -m pip uninstall -y ${packageName}
|
||||||
${pythonEnv} -m pip install ${wheel}
|
${python} -m pip install ${wheel}
|
||||||
${pythonEnv} -m unittest
|
${python} -m unittest
|
||||||
|
|
||||||
# rm -rf venv
|
|
||||||
# rm -rf build
|
# rm -rf build
|
||||||
|
|
||||||
exit 0
|
exit 0
|
Loading…
Reference in New Issue
Block a user