Skip to content

Commit 416a306

Browse files
committed
Split sqlite3 build in build_cpython image
1 parent 05a341c commit 416a306

File tree

4 files changed

+42
-24
lines changed

4 files changed

+42
-24
lines changed

docker/Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ RUN export CMAKE_VERSION=3.18.3 && \
7979

8080

8181
FROM build_base AS build_cpython
82+
COPY build_scripts/build-sqlite3.sh /build_scripts/
83+
RUN export SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3340000 && \
84+
export SQLITE_AUTOCONF_HASH=bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee && \
85+
export SQLITE_AUTOCONF_DOWNLOAD_URL=https://www.sqlite.org/2020 && \
86+
manylinux-entrypoint /build_scripts/build-sqlite3.sh
87+
8288
COPY build_scripts/*pubkey*.txt /build_scripts/
8389
COPY build_scripts/build_env.sh /build_scripts/
8490
COPY build_scripts/build-cpython.sh /build_scripts/

docker/build_scripts/build-cpython.sh

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,6 @@ source $MY_DIR/build_env.sh
1111
# Get build utilities
1212
source $MY_DIR/build_utils.sh
1313

14-
# Install a more recent SQLite3
15-
curl -fsSLO $SQLITE_AUTOCONF_DOWNLOAD_URL/$SQLITE_AUTOCONF_ROOT.tar.gz
16-
check_sha256sum $SQLITE_AUTOCONF_ROOT.tar.gz $SQLITE_AUTOCONF_HASH
17-
tar xfz $SQLITE_AUTOCONF_ROOT.tar.gz
18-
cd $SQLITE_AUTOCONF_ROOT
19-
DESTDIR=/sqlite3 do_standard_install
20-
cd ..
21-
rm -rf $SQLITE_AUTOCONF_ROOT*
22-
rm /sqlite3/usr/local/lib/libsqlite3.a
23-
# Install for build
24-
cp -rf /sqlite3/* /
25-
# Clean-up for runtime
26-
rm -rf /sqlite3/usr/local/bin /sqlite3/usr/local/include /sqlite3/usr/local/lib/pkg-config /sqlite3/usr/local/share
27-
# Install for runtime
28-
mkdir -p /manylinux-rootfs
29-
cp -rf /sqlite3/* /manylinux-rootfs/
30-
# clean-up
31-
rm -rf /sqlite3
32-
33-
3414
# Compile the latest Python releases.
3515
# (In order to have a proper SSL module, Python is compiled
3616
# against a recent openssl [see env vars above], which is linked

docker/build_scripts/build-sqlite3.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 a more recent SQLite3
14+
check_var ${SQLITE_AUTOCONF_ROOT}
15+
check_var ${SQLITE_AUTOCONF_HASH}
16+
check_var ${SQLITE_AUTOCONF_DOWNLOAD_URL}
17+
fetch_source ${SQLITE_AUTOCONF_ROOT}.tar.gz ${SQLITE_AUTOCONF_DOWNLOAD_URL}
18+
check_sha256sum ${SQLITE_AUTOCONF_ROOT}.tar.gz ${SQLITE_AUTOCONF_HASH}
19+
tar xfz ${SQLITE_AUTOCONF_ROOT}.tar.gz
20+
pushd ${SQLITE_AUTOCONF_ROOT}
21+
DESTDIR=/manylinux-rootfs do_standard_install
22+
popd
23+
rm -rf ${SQLITE_AUTOCONF_ROOT} ${SQLITE_AUTOCONF_ROOT}.tar.gz
24+
25+
# static library is unused, remove it
26+
rm /manylinux-rootfs/usr/local/lib/libsqlite3.a
27+
28+
# Strip what we can
29+
strip_ /manylinux-rootfs
30+
31+
# Install
32+
cp -rf /manylinux-rootfs/* /
33+
34+
# Clean-up for runtime
35+
rm -rf /manylinux-rootfs/usr/local/bin /manylinux-rootfs/usr/local/include /manylinux-rootfs/usr/local/lib/pkg-config /manylinux-rootfs/usr/local/share
36+
find -L /manylinux-rootfs -type f -a -not -name 'libsqlite3.so.*' -delete

docker/build_scripts/build_env.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@
33
PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python
44
# of the form <maj>.<min>.<rev> or <maj>.<min>.<rev>rc<n>
55
CPYTHON_VERSIONS="3.5.10 3.6.12 3.7.9 3.8.7 3.9.1"
6-
7-
SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3340000
8-
SQLITE_AUTOCONF_HASH=bf6db7fae37d51754737747aaaf413b4d6b3b5fbacd52bdb2d0d6e5b2edd9aee
9-
SQLITE_AUTOCONF_DOWNLOAD_URL=https://www.sqlite.org/2020

0 commit comments

Comments
 (0)