Skip to content

Commit

Permalink
Merge pull request #169: Build CVXOPT in cached section
Browse files Browse the repository at this point in the history
  • Loading branch information
victorlin authored Jul 5, 2023
2 parents 64fcc1f + ada1fcd commit 5a26ce4
Showing 1 changed file with 32 additions and 29 deletions.
61 changes: 32 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,38 @@ RUN pip3 install pysam==0.19.1
# Install pango_aliasor (for forecasts-ncov)
RUN pip3 install pango_aliasor==0.3.0

# Build CVXOPT on linux/arm64
# CVXOPT, an Augur dependency, does not have pre-built binaries for linux/arm64¹.
#
# First, add system deps for building²:
# - gcc: C compiler.
# - libc6-dev: C libraries and header files.
# - libopenblas-dev: Contains optimized versions of BLAS and LAPACK.
# - SuiteSparse: Download the source code so it can be built alongside CVXOPT.
#
# Then, "install" (build) separately since the process requires a special
# environment variable³.
#
# ¹ https://github.com/cvxopt/cvxopt-wheels/issues/12
# ² https://cvxopt.org/install/#building-and-installing-from-source
# ³ https://cvxopt.org/install/#ubuntu-debian
#
# TODO: If this is removed, the installation of libopenblas in the final stage
# should also be removed.
WORKDIR /cvxopt
RUN if [[ "$TARGETPLATFORM" == linux/arm64 ]]; then \
apt-get update && apt-get install -y --no-install-recommends \
gcc \
libc6-dev \
libopenblas-dev \
&& mkdir SuiteSparse \
&& curl -fsSL https://api.github.com/repos/DrTimothyAldenDavis/SuiteSparse/tarball/v5.8.1 \
| tar xzvpf - --no-same-owner --strip-components=1 -C SuiteSparse \
&& CVXOPT_SUITESPARSE_SRC_DIR=$(pwd)/SuiteSparse \
pip3 install cvxopt==1.3.1 \
; \
fi


# 2. Add unpinned programs

Expand All @@ -314,35 +346,6 @@ RUN /builder-scripts/download-repo https://github.com/nextstrain/fauna master .
RUN pip3 install phylo-treetime

# Augur

# Build CVXOPT on linux/arm64
# CVXOPT, an Augur dependency, does not have pre-built binaries for linux/arm64.
#
# First, add system deps for building¹:
# - gcc: C compiler.
# - libc6-dev: C libraries and header files.
# - libopenblas-dev: Contains optimized versions of BLAS and LAPACK.
# - SuiteSparse: Download the source code so it can be built alongside CVXOPT.
#
# Then, "install" (build) separately since the process requires a special
# environment variable².
#
# ¹ https://cvxopt.org/install/#building-and-installing-from-source
# ² https://cvxopt.org/install/#ubuntu-debian
WORKDIR /cvxopt
RUN if [[ "$TARGETPLATFORM" == linux/arm64 ]]; then \
apt-get update && apt-get install -y --no-install-recommends \
gcc \
libc6-dev \
libopenblas-dev \
&& mkdir SuiteSparse \
&& curl -fsSL https://api.github.com/repos/DrTimothyAldenDavis/SuiteSparse/tarball/v5.8.1 \
| tar xzvpf - --no-same-owner --strip-components=1 -C SuiteSparse \
&& CVXOPT_SUITESPARSE_SRC_DIR=$(pwd)/SuiteSparse \
pip3 install cvxopt \
; \
fi

# Augur is an editable install so we can overlay the augur version in the image
# with --volume=.../augur:/nextstrain/augur and still have it globally
# accessible and importable.
Expand Down

0 comments on commit 5a26ce4

Please sign in to comment.