Skip to content

Commit 0558012

Browse files
committed
完善自定义镜像的文档
1 parent 815206f commit 0558012

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

docs/feapder_platform/feaplat.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,38 @@ ssh-keygen -t rsa -C "备注" -f 生成路径/文件名
274274
```
275275
FROM registry.cn-hangzhou.aliyuncs.com/feapderd/feapder:[最新版本号]
276276
277+
# 安装自定义的python版本,如3.7
278+
RUN set -ex \
279+
&& wget https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz \
280+
&& tar -zxvf Python-3.7.5.tgz \
281+
&& cd Python-3.7.5 \
282+
&& ./configure prefix=/usr/local/python3 \
283+
&& make \
284+
&& make install \
285+
&& make clean \
286+
&& rm -rf /Python-3.7.5* \
287+
&& yum install -y epel-release \
288+
&& yum install -y python-pip
289+
290+
# 设置默认为python3
291+
RUN set -ex \
292+
# 备份旧版本python
293+
&& mv /usr/bin/python /usr/bin/python27 \
294+
&& mv /usr/bin/pip /usr/bin/pip-python2.7 \
295+
# 配置默认为python3
296+
&& ln -s /usr/local/python3/bin/python3.7 /usr/bin/python \
297+
&& ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 \
298+
&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip \
299+
&& ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
300+
301+
ENV PATH=$PATH:/usr/local/python3/bin/
302+
277303
# 安装依赖
278304
RUN pip3 install feapder \
279305
&& pip3 install scrapy
306+
307+
# 安装node依赖包,内置的node为v10.15.3版本
308+
RUN npm install packageName -g
280309
281310
```
282311

@@ -294,7 +323,9 @@ docker build -f feapder_dockerfile -t my_feapder:1.0 .
294323
SPIDER_IMAGE=my_feapder:1.0
295324
```
296325

297-
注:若有多个worker服务器,且没将镜像传到镜像服务,则需要手动将镜像推到其他服务器上,否则无法拉取此镜像运行
326+
注:
327+
1. 若有多个worker服务器,且没将镜像传到镜像服务,则需要手动将镜像推到其他服务器上,否则无法拉取此镜像运行
328+
2. 若自定义了python版本,则需要删除之前feaplat的挂载,命令 `docker volume rm feapder_python37`,否则可能库的版本不兼容。若报该挂载被占用,则需要删除对应的容器,命令 `docker stop 容器id && docker rm 容器id`**容器id都不会看,建议别折腾了**
298329

299330
## 价格
300331

0 commit comments

Comments
 (0)