Skip to content

[manylinux2014] Split cpython build from build_base image #971

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
18 changes: 11 additions & 7 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@ RUN export LIBXCRYPT_VERSION=4.4.17 && \


FROM runtime_base AS build_base
COPY build_scripts/*pubkey*.txt /build_scripts/
COPY build_scripts/build.sh /build_scripts/
COPY build_scripts/build_env.sh /build_scripts/
RUN manylinux-entrypoint bash build_scripts/build.sh
COPY build_scripts/install-build-packages.sh /build_scripts/
RUN manylinux-entrypoint /build_scripts/install-build-packages.sh


FROM build_base AS build_git
Expand All @@ -80,12 +78,18 @@ RUN export CMAKE_VERSION=3.18.3 && \
manylinux-entrypoint /build_scripts/build-cmake.sh


FROM build_base AS build_cpython
COPY build_scripts/*pubkey*.txt /build_scripts/
COPY build_scripts/build_env.sh /build_scripts/
COPY build_scripts/build-cpython.sh /build_scripts/
RUN manylinux-entrypoint /build_scripts/build-cpython.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
COPY --from=build_cpython /manylinux-rootfs /
COPY --from=build_cpython /opt/_internal /opt/_internal/
COPY build_scripts/finalize.sh /build_scripts/finalize.sh
COPY build_scripts/python-tag-abi-tag.py /build_scripts/python-tag-abi-tag.py
COPY build_scripts/ssl-check.py /build_scripts/ssl-check.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ source $MY_DIR/build_env.sh
# Get build utilities
source $MY_DIR/build_utils.sh

# Dependencies for compiling Python that we want to remove from
# the final image after compiling Python
PYTHON_COMPILE_DEPS="zlib-devel bzip2-devel expat-devel ncurses-devel readline-devel tk-devel gdbm-devel libdb-devel libpcap-devel xz-devel openssl-devel keyutils-libs-devel krb5-devel libcom_err-devel libidn-devel curl-devel perl-devel libffi-devel kernel-devel"
CMAKE_DEPS="openssl-devel zlib-devel libcurl-devel"

# Development tools and libraries
yum -y install ${PYTHON_COMPILE_DEPS} ${CMAKE_DEPS}

# 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 Down
16 changes: 16 additions & 0 deletions docker/build_scripts/install-build-packages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
# Top-level build script called from Dockerfile

# Stop at any error, show all commands
set -ex

# Set build environment variables
MY_DIR=$(dirname "${BASH_SOURCE[0]}")

# Dependencies for compiling Python that we want to remove from
# the final image after compiling Python
PYTHON_COMPILE_DEPS="zlib-devel bzip2-devel expat-devel ncurses-devel readline-devel tk-devel gdbm-devel libdb-devel libpcap-devel xz-devel openssl-devel keyutils-libs-devel krb5-devel libcom_err-devel libidn-devel curl-devel perl-devel libffi-devel kernel-devel"
CMAKE_DEPS="openssl-devel zlib-devel libcurl-devel"

# Development tools and libraries
yum -y install ${PYTHON_COMPILE_DEPS} ${CMAKE_DEPS}