Skip to content

[manylinux2014] Split git build from build_base image #970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,26 @@ COPY build_scripts/build.sh /build_scripts/
COPY build_scripts/build_env.sh /build_scripts/
RUN manylinux-entrypoint bash build_scripts/build.sh


FROM build_base AS build_git
COPY build_scripts/build-git.sh /build_scripts/
RUN export GIT_ROOT=git-2.30.0 && \
export GIT_HASH=d24c4fa2a658318c2e66e25ab67cc30038a35696d2d39e6b12ceccf024de1e5e && \
export GIT_DOWNLOAD_URL=https://www.kernel.org/pub/software/scm/git && \
manylinux-entrypoint /build_scripts/build-git.sh


FROM build_base AS build_cmake
COPY build_scripts/build-cmake.sh /build_scripts/build-cmake.sh
COPY build_scripts/build-cmake.sh /build_scripts/
RUN export CMAKE_VERSION=3.18.3 && \
export CMAKE_HASH=2c89f4e30af4914fd6fb5d00f863629812ada848eee4e2d29ec7e456d7fa32e5 && \
export CMAKE_DOWNLOAD_URL=https://github.com/Kitware/CMake/releases/download && \
manylinux-entrypoint /build_scripts/build-cmake.sh


FROM runtime_base
COPY --from=build_base /manylinux-rootfs /
COPY --from=build_git /manylinux-rootfs /
COPY --from=build_cmake /manylinux-rootfs /
COPY --from=build_base /opt/_internal /opt/_internal/
COPY build_scripts/build_utils.sh /build_scripts/build_utils.sh
Expand Down
33 changes: 33 additions & 0 deletions docker/build_scripts/build-git.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# Top-level build script called from Dockerfile

# Stop at any error, show all commands
set -exuo pipefail

# Get script directory
MY_DIR=$(dirname "${BASH_SOURCE[0]}")

# Get build utilities
source $MY_DIR/build_utils.sh

# Install newest libtool
check_var ${GIT_ROOT}
check_var ${GIT_HASH}
check_var ${GIT_DOWNLOAD_URL}

fetch_source ${GIT_ROOT}.tar.gz ${GIT_DOWNLOAD_URL}
check_sha256sum ${GIT_ROOT}.tar.gz ${GIT_HASH}
tar -xzf ${GIT_ROOT}.tar.gz
pushd ${GIT_ROOT}
make -j$(nproc) install prefix=/usr/local NO_GETTEXT=1 NO_TCLTK=1 DESTDIR=/manylinux-rootfs
popd
rm -rf ${GIT_ROOT} ${GIT_ROOT}.tar.gz


# Strip what we can
strip_ /manylinux-rootfs

# Install
cp -rf /manylinux-rootfs/* /

git version
5 changes: 1 addition & 4 deletions docker/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ CMAKE_DEPS="openssl-devel zlib-devel libcurl-devel"
# Development tools and libraries
yum -y install ${PYTHON_COMPILE_DEPS} ${CMAKE_DEPS}

# Install git
build_git $GIT_ROOT $GIT_HASH
/manylinux-rootfs/usr/local/bin/git version

# Install a more recent SQLite3
curl -fsSLO $SQLITE_AUTOCONF_DOWNLOAD_URL/$SQLITE_AUTOCONF_ROOT.tar.gz
check_sha256sum $SQLITE_AUTOCONF_ROOT.tar.gz $SQLITE_AUTOCONF_HASH
Expand All @@ -37,6 +33,7 @@ cp -rf /sqlite3/* /
# Clean-up for runtime
rm -rf /sqlite3/usr/local/bin /sqlite3/usr/local/include /sqlite3/usr/local/lib/pkg-config /sqlite3/usr/local/share
# Install for runtime
mkdir -p /manylinux-rootfs
cp -rf /sqlite3/* /manylinux-rootfs/
# clean-up
rm -rf /sqlite3
Expand Down
4 changes: 0 additions & 4 deletions docker/build_scripts/build_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ CPYTHON_VERSIONS="3.5.10 3.6.12 3.7.9 3.8.7 3.9.1"
SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3340000
SQLITE_AUTOCONF_HASH=bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee
SQLITE_AUTOCONF_DOWNLOAD_URL=https://www.sqlite.org/2020

GIT_ROOT=git-2.30.0
GIT_HASH=d24c4fa2a658318c2e66e25ab67cc30038a35696d2d39e6b12ceccf024de1e5e
GIT_DOWNLOAD_URL=https://www.kernel.org/pub/software/scm/git
14 changes: 0 additions & 14 deletions docker/build_scripts/build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,6 @@ function check_sha256sum {
}


function build_git {
local git_fname=$1
check_var ${git_fname}
local git_sha256=$2
check_var ${git_sha256}
check_var ${GIT_DOWNLOAD_URL}
fetch_source ${git_fname}.tar.gz ${GIT_DOWNLOAD_URL}
check_sha256sum ${git_fname}.tar.gz ${git_sha256}
tar -xzf ${git_fname}.tar.gz
(cd ${git_fname} && make -j$(nproc) install prefix=/usr/local NO_GETTEXT=1 NO_TCLTK=1 DESTDIR=/manylinux-rootfs > /dev/null)
rm -rf ${git_fname} ${git_fname}.tar.gz
}


function do_standard_install {
./configure "$@" > /dev/null
make -j$(nproc) > /dev/null
Expand Down