2017-08-01 65 views
1

嗨,大家好,我正在嘗試從碼頭中的源代碼構建numpy。 這是我Dockerfile:從碼頭中的源代碼構建numpy

FROM debian:testing 
MAINTAINER Dr Suman Khanal <[email protected]> 
LABEL updated_at '2017-07-26' 
WORKDIR/
RUN apt-get update \ 
&& apt-get install -y gnupg git wget build-essential python3 python3-dev 
python3-setuptools python3-pip libatlas3-base libatlas-dev libatlas-base-dev 
liblapack-dev libblas-common libblas3 libblas-dev cython 

RUN git clone https://github.com/numpy/numpy.git 
WORKDIR /numpy 
RUN python3 setup.py build --fcompiler=gnu95 install 
CMD ["numpy"] 

但其引發此錯誤。 Build failed: The command '/bin/sh -c python3 setup.py build --fcompiler=gnu95 install' returned a non-zero code: 1 任何幫助?

非常感謝,

網速慢

回答

0

這裏工作Dockerfile

FROM debian:testing 

MAINTAINER Dr Suman Khanal <[email protected]> 
LABEL updated_at '2017-07-26' 

WORKDIR/
RUN apt-get update \ 
&& apt-get install -y gnupg git wget build-essential python3 python3-dev \ 
&& apt-get install -y python3-setuptools python3-pip libatlas3-base \ 
&& apt-get install -y libatlas-dev libatlas-base-dev libblas3 libblas-dev cython 

RUN git clone https://github.com/numpy/numpy.git 
WORKDIR /numpy 

RUN python3 setup.py build --fcompiler=gnu95 install 
RUN pip3 install nose 

CMD ["python3", "/numpy/numpy/tests/test_ctypeslib.py"] 

我成功構建並運行測試了它:

$ docker run -it test-numpy 
....... 
---------------------------------------------------------------------- 
Ran 7 tests in 0.004s 

OK 

而且我不知道你想CMD ["numpy"]實現的,因爲它的目錄什麼。我添加了安裝nose b/c它是numpy的測試所必需的。

您可以測試和碼頭工人與numpy的發揮:

docker exec -it test-numpy bash 
+0

謝謝你,它的工作。但我無法理解這個命令'CMD [「python3」,「/numpy/numpy/tests/test_ctypeslib.py」]'。你能解釋一下嗎? –

+0

@Suman它只是運行numpy的測試,以確保它是否工作。您可以定義自己的命令或任何您需要的內容。 – VladoDemcak