Skip to content

Commit

Permalink
Use the system package version of the cryptography Python package
Browse files Browse the repository at this point in the history
I am having timeout issues when building a wheel for the `cryptography`
package on platforms that do not have a wheel available from PyPI.
Switching to a system package version is the sanest (to me) workaround.
The system packages that are installed to build the package on these
platforms are removed as part of this change.
  • Loading branch information
mcdonnnj committed Jan 14, 2025
1 parent 4aeceb9 commit b4eacaa
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 47 deletions.
17 changes: 6 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,10 @@ ENV PYTHON_PIPENV_VERSION=2024.1.0
ENV PYTHON_SETUPTOOLS_VERSION=75.1.0
ENV PYTHON_WHEEL_VERSION=0.44.0

# Install the dependencies necessary to build the cryptography Python
# package. These are required to build the package if a pre-built wheel
# is not available on PyPI.
# Install the system package dependencies necessary to set up the image's Python
# virtual environment.
RUN apk --no-cache add \
cargo=1.78.0-r0 \
gcc=13.2.1_git20240309-r0 \
git=2.45.2-r0 \
libffi-dev=3.4.6-r0 \
musl-dev=1.2.5-r0 \
openssl-dev=3.3.2-r1 \
py3-cryptography=42.0.7-r0 \
py3-pip=24.0-r2 \
py3-setuptools=70.3.0-r0 \
py3-wheel=0.42.0-r1 \
Expand All @@ -57,7 +51,7 @@ RUN python3 -m venv --system-site-packages /usr/local \
&& /usr/local/bin/python3 -m pip install --no-cache-dir --upgrade \
pipenv==${PYTHON_PIPENV_VERSION} \
# Manually create the virtual environment
&& python3 -m venv ${VIRTUAL_ENV} \
&& python3 -m venv --system-site-packages ${VIRTUAL_ENV} \
# Ensure the core Python packages are installed in the virtual environment
&& ${VIRTUAL_ENV}/bin/python3 -m pip install --no-cache-dir --upgrade \
pip==${PYTHON_PIP_VERSION} \
Expand Down Expand Up @@ -103,7 +97,8 @@ ENV VIRTUAL_ENV="${CISA_HOME}/.venv"
# estimate labor hours for code.
RUN apk --no-cache add \
cloc=2.00-r0 \
git=2.45.2-r0
git=2.45.2-r0 \
py3-cryptography=42.0.7-r0

###
# Create unprivileged user
Expand Down
3 changes: 3 additions & 0 deletions src/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ name = "pypi"
[packages]
# Minimum version for IMDSv2 support
boto3 = ">=1.13.23"
# We need to use the system package version of this package. This matches the version
# available for Alpine Linux 3.20.
cryptography = "42.0.7"
docopt = ">=0.6.2"
# We need a bugfix for behavior in newer versions of cloc. Since there is not a
# release on PyPI with the code in https://github.com/LLNL/scraper/pull/79, we
Expand Down
78 changes: 42 additions & 36 deletions src/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b4eacaa

Please sign in to comment.