Skip to content

Commit ca341a6

Browse files
committed
Split git build from build_base image
1 parent 6b6cdf6 commit ca341a6

File tree

5 files changed

+45
-23
lines changed

5 files changed

+45
-23
lines changed

docker/Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,26 @@ COPY build_scripts/build.sh /build_scripts/
6363
COPY build_scripts/build_env.sh /build_scripts/
6464
RUN manylinux-entrypoint bash build_scripts/build.sh
6565

66+
67+
FROM build_base AS build_git
68+
COPY build_scripts/build-git.sh /build_scripts/
69+
RUN export GIT_ROOT=git-2.30.0 && \
70+
export GIT_HASH=d24c4fa2a658318c2e66e25ab67cc30038a35696d2d39e6b12ceccf024de1e5e && \
71+
export GIT_DOWNLOAD_URL=https://www.kernel.org/pub/software/scm/git && \
72+
manylinux-entrypoint /build_scripts/build-git.sh
73+
74+
6675
FROM build_base AS build_cmake
67-
COPY build_scripts/build-cmake.sh /build_scripts/build-cmake.sh
76+
COPY build_scripts/build-cmake.sh /build_scripts/
6877
RUN export CMAKE_VERSION=3.18.3 && \
6978
export CMAKE_HASH=2c89f4e30af4914fd6fb5d00f863629812ada848eee4e2d29ec7e456d7fa32e5 && \
7079
export CMAKE_DOWNLOAD_URL=https://github.com/Kitware/CMake/releases/download && \
7180
manylinux-entrypoint /build_scripts/build-cmake.sh
7281

82+
7383
FROM runtime_base
7484
COPY --from=build_base /manylinux-rootfs /
85+
COPY --from=build_git /manylinux-rootfs /
7586
COPY --from=build_cmake /manylinux-rootfs /
7687
COPY --from=build_base /opt/_internal /opt/_internal/
7788
COPY build_scripts/build_utils.sh /build_scripts/build_utils.sh

docker/build_scripts/build-git.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# Top-level build script called from Dockerfile
3+
4+
# Stop at any error, show all commands
5+
set -exuo pipefail
6+
7+
# Get script directory
8+
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
9+
10+
# Get build utilities
11+
source $MY_DIR/build_utils.sh
12+
13+
# Install newest libtool
14+
check_var ${GIT_ROOT}
15+
check_var ${GIT_HASH}
16+
check_var ${GIT_DOWNLOAD_URL}
17+
18+
fetch_source ${GIT_ROOT}.tar.gz ${GIT_DOWNLOAD_URL}
19+
check_sha256sum ${GIT_ROOT}.tar.gz ${GIT_HASH}
20+
tar -xzf ${GIT_ROOT}.tar.gz
21+
pushd ${GIT_ROOT}
22+
make -j$(nproc) install prefix=/usr/local NO_GETTEXT=1 NO_TCLTK=1 DESTDIR=/manylinux-rootfs
23+
popd
24+
rm -rf ${GIT_ROOT} ${GIT_ROOT}.tar.gz
25+
26+
27+
# Strip what we can
28+
strip_ /manylinux-rootfs
29+
30+
# Install
31+
cp -rf /manylinux-rootfs/* /
32+
33+
git version

docker/build_scripts/build.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ CMAKE_DEPS="openssl-devel zlib-devel libcurl-devel"
1919
# Development tools and libraries
2020
yum -y install ${PYTHON_COMPILE_DEPS} ${CMAKE_DEPS}
2121

22-
# Install git
23-
build_git $GIT_ROOT $GIT_HASH
24-
/manylinux-rootfs/usr/local/bin/git version
25-
2622
# Install a more recent SQLite3
2723
curl -fsSLO $SQLITE_AUTOCONF_DOWNLOAD_URL/$SQLITE_AUTOCONF_ROOT.tar.gz
2824
check_sha256sum $SQLITE_AUTOCONF_ROOT.tar.gz $SQLITE_AUTOCONF_HASH

docker/build_scripts/build_env.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,3 @@ CPYTHON_VERSIONS="3.5.10 3.6.12 3.7.9 3.8.7 3.9.1"
77
SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3340000
88
SQLITE_AUTOCONF_HASH=bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee
99
SQLITE_AUTOCONF_DOWNLOAD_URL=https://www.sqlite.org/2020
10-
11-
GIT_ROOT=git-2.30.0
12-
GIT_HASH=d24c4fa2a658318c2e66e25ab67cc30038a35696d2d39e6b12ceccf024de1e5e
13-
GIT_DOWNLOAD_URL=https://www.kernel.org/pub/software/scm/git

docker/build_scripts/build_utils.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,6 @@ function check_sha256sum {
9898
}
9999

100100

101-
function build_git {
102-
local git_fname=$1
103-
check_var ${git_fname}
104-
local git_sha256=$2
105-
check_var ${git_sha256}
106-
check_var ${GIT_DOWNLOAD_URL}
107-
fetch_source ${git_fname}.tar.gz ${GIT_DOWNLOAD_URL}
108-
check_sha256sum ${git_fname}.tar.gz ${git_sha256}
109-
tar -xzf ${git_fname}.tar.gz
110-
(cd ${git_fname} && make -j$(nproc) install prefix=/usr/local NO_GETTEXT=1 NO_TCLTK=1 DESTDIR=/manylinux-rootfs > /dev/null)
111-
rm -rf ${git_fname} ${git_fname}.tar.gz
112-
}
113-
114-
115101
function do_standard_install {
116102
./configure "$@" > /dev/null
117103
make -j$(nproc) > /dev/null

0 commit comments

Comments
 (0)