作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试创建一个具有 Python3 和 Node v4.4.7 的 docker 镜像,以便我可以将其用作需要 Python 和该版本 Node.js 的项目的容器。
# Pull base image.
FROM python:3-onbuild
CMD [ "python", "./hello.py" ]
# Install Node.js
RUN \
cd /tmp && \
wget http://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz && \
tar xvzf node-v4.4.7.tar.gz && \
rm -f node-v4.4.7.tar.gz && \
cd node-v* && \
./configure && \
CXX="g++ -Wno-unused-local-typedefs" make && \
CXX="g++ -Wno-unused-local-typedefs" make install && \
cd /tmp && \
rm -rf /tmp/node-v* && \
npm install -g npm && \
print '\n# Node.js\nexport PATH="node_modules/.bin:$PATH"' >> /root/.bashrc
# Define working directory.
WORKDIR /data
# Define default command.
CMD ["bash"]
hello.py
就是这样:
print "Hello, Python!"
requirements.txt
文件所以添加了一个空的
requirements.txt
docker build -t isaacweathersnet/sampledockerimage .
它在 Node 安装过程中出现困惑
node-v4.4.0/benchmark/arrays/zero-int.js
File "./configure", line 446
'''
^
SyntaxError: Missing parentheses in call to 'print'
The command '/bin/sh -c cd /tmp && wget http://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz && tar xvzf node-v4.4.7.tar.gz && rm -f node-v4.4.7.tar.gz && cd node-v* && ./configure && CXX="g++ -Wno-unused-local-typedefs" make && CXX="g++ -Wno-unused-local-typedefs" make install && cd /tmp && rm -rf /tmp/node-v* && npm install -g npm && print '\n# Node.js\nexport PATH="node_modules/.bin:$PATH"' >> /root/.bashrc' returned a non-zero code: 1
最佳答案
在 Github 上找到了具有 Python 和 Node.js 的解决方案。 Python 3+ 不走运,但在 2.7 上运行良好
https://github.com/nsdont/python-node/blob/master/Dockerfile
FROM python:2.7
RUN \
cd /tmp && \
wget http://nodejs.org/dist/v4.4.7/node-v4.4.7.tar.gz && \
tar xvzf node-v4.4.7.tar.gz && \
rm -f node-v4.4.7.tar.gz && \
cd node-v* && \
./configure && \
CXX="g++ -Wno-unused-local-typedefs" make && \
CXX="g++ -Wno-unused-local-typedefs" make install && \
cd /tmp && \
rm -rf /tmp/node-v* && \
npm install -g npm && \
echo -e '\n# Node.js\nexport PATH="node_modules/.bin:$PATH"' >> /root/.bashrc
# Define working directory.
WORKDIR /data
# Define default command.
CMD ["bash"]
关于python - 使用 Nodev4.4.7 和 Python3 创建 Docker 容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40872544/
我正在学习如何使用 pytest-nodev搜索由单元测试定义的函数的实现。对于具有两个(或更多)参数的函数,是否有任何方法可以自动尝试输入参数的所有排列? 例如,使用以下测试函数: def test
我正在尝试在 ath9k 内核驱动程序模块中启用调试。 由于调试使用debugfs,我需要挂载debugfs。但是人们和互联网建议安装命令有点不同: # (Note) mount usage: mou
我是一名优秀的程序员,十分优秀!