|
| 1 | +ARG BASE_CONTAINER=python:3.9-slim-buster |
| 2 | +FROM ${BASE_CONTAINER} as suitesparse |
| 3 | +ENV DEBIAN_FRONTEND=noninteractive |
| 4 | + |
| 5 | +RUN apt-get update && apt-get install -yq build-essential cmake git |
| 6 | + |
| 7 | +ARG SUITESPARSE |
| 8 | +ARG COMPACT |
| 9 | + |
| 10 | +WORKDIR /build |
| 11 | +RUN git clone https://github.com/eliben/pycparser.git --depth 1 |
| 12 | + |
| 13 | +WORKDIR /build/GraphBLAS/build |
| 14 | +RUN git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git --depth 1 --branch v${SUITESPARSE} \ |
| 15 | + && cd GraphBLAS/build \ |
| 16 | + && cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DGBCOMPACT=${COMPACT} \ |
| 17 | + && make -j$(nproc) \ |
| 18 | + && make install |
| 19 | + |
| 20 | +FROM ${BASE_CONTAINER} as psg |
| 21 | +ARG SUITESPARSE |
| 22 | +ARG VERSION |
| 23 | +ENV PYTHONUNBUFFERED 1 |
| 24 | + |
| 25 | +COPY --from=suitesparse /usr/include/GraphBLAS.h /usr/local/include/ |
| 26 | +COPY --from=suitesparse /usr/lib/x86_64-linux-gnu/libgraphblas* /usr/lib/x86_64-linux-gnu/ |
| 27 | +COPY --from=suitesparse /build/pycparser/utils/fake_libc_include/* /usr/local/lib/python3.9/site-packages/pycparser/utils/fake_libc_include/ |
| 28 | + |
| 29 | +RUN apt-get update && apt-get install -yq build-essential git |
| 30 | +RUN pip3 install numpy cffi pytest cython |
| 31 | + |
| 32 | +RUN mkdir -p /build/python-suitesparse-graphblas |
| 33 | +ADD . /build/python-suitesparse-graphblas |
| 34 | + |
| 35 | +WORKDIR /build/python-suitesparse-graphblas |
| 36 | +RUN git tag ${VERSION} && \ |
| 37 | + python3 suitesparse_graphblas/create_headers.py && \ |
| 38 | + python3 setup.py install && \ |
| 39 | + ldconfig |
| 40 | + |
| 41 | +WORKDIR / |
| 42 | +RUN pytest --pyargs suitesparse_graphblas.tests |
| 43 | +RUN apt-get -y --purge remove git python3-pip && apt-get clean |
| 44 | + |
| 45 | +FROM ${BASE_CONTAINER} |
| 46 | +COPY --from=suitesparse /usr/lib/x86_64-linux-gnu/libgraphblas* /usr/lib/x86_64-linux-gnu/ |
| 47 | +COPY --from=suitesparse /usr/lib/x86_64-linux-gnu/libgomp* /usr/lib/x86_64-linux-gnu/ |
| 48 | +COPY --from=psg /usr/local/lib/python3.9/site-packages /usr/local/lib/python3.9/site-packages |
0 commit comments