-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
36 lines (31 loc) · 1.35 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# vim:set ft=dockerfile:
FROM slothai/openblas:0.3.1 as openblas
FROM python:3.6.5-alpine3.7
# Metadata as defined at http://label-schema.org
ARG BUILD_DATE
ARG VCS_REF
ARG NUMPY_VERSION=1.15.0
COPY --from=openblas /opt/OpenBLAS/ /opt/OpenBLAS/
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="NumPy" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/slothai/docker-numpy" \
org.label-schema.vendor="SlothAI <https://slothai.github.io/>" \
org.label-schema.schema-version="1.0"
RUN apk add --no-cache --virtual .meta-build-dependencies \
gcc \
musl-dev && \
apk add --no-cache gfortran && \
wget -O numpy.tar.gz "https://github.com/numpy/numpy/archive/v$NUMPY_VERSION.tar.gz" && tar xzf numpy.tar.gz && rm -f numpy.tar.gz && \
echo -e "[openblas]\n\
libraries = openblas\n\
library_dirs = /opt/OpenBLAS/lib\n\
include_dirs = /opt/OpenBLAS/include\n\
runtime_library_dirs = /opt/OpenBLAS/lib\
" > /numpy-$NUMPY_VERSION/site.cfg && \
pip install Cython==0.28.2 && \
cd /numpy-$NUMPY_VERSION/ && python setup.py build --parallel=$(nproc) --fcompiler=gfortran && python setup.py install && cd / && \
rm -rf /numpy-$NUMPY_VERSION/ && \
pip uninstall --yes Cython && \
apk del .meta-build-dependencies && \
find / -type d -name __pycache__ -exec rm -r {} +