|
@@ -367,8 +367,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
FROM buildpack-deps:buster
|
|
|
|
|
|
# ensure local python is preferred over distribution python
|
|
@@ -495,6 +493,17 @@
|
|
|
\) -exec rm -rf '{}' +; \
|
|
|
rm -f get-pip.py
|
|
|
|
|
|
+ RUN pip3 install shapely -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
|
+ && pip3 install matplotlib -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
|
+ && pip3 install short-text-sim -i http://dev.dp.sagacloud.cn:8082/repository/saga-pypi-group/simple --trusted-host dev.dp.sagacloud.cn \
|
|
|
+ && pip3 install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
|
+ && pip3 install vg -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
|
+ && pip3 install networkx -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
|
+ && pip3 install jieba -i https://pypi.tuna.tsinghua.edu.cn/simple \
|
|
|
+ && cd /usr/local/lib/python3.7/site-packages \
|
|
|
+ && git clone http://39.106.8.246:3003/chenhaiyang/relations.git
|
|
|
+
|
|
|
+
|
|
|
# CMD ["python3"]
|
|
|
|
|
|
|
|
@@ -689,12 +698,15 @@
|
|
|
|
|
|
EXPOSE 5432
|
|
|
CMD ["postgres"]
|
|
|
-
|
|
|
</details>
|
|
|
|
|
|
3. 文件内容说明
|
|
|
1). docker-entrypoint.sh 是postgresql数据库的配置文件, 会拷贝到镜像内部使用
|
|
|
- 2). Dockerfile是docker用来构建镜像的文件, 分为三部分 分别是 安装python3, 安装postgresql数据库, 安装plpython3插件
|
|
|
+ 2). Dockerfile是docker用来构建镜像的文件, 分为三部分
|
|
|
+ 1. 安装python3
|
|
|
+ 2. 安装python模块 vg, matplotlib, shapely, jieba, short-text-sim, networkx, numpy, git上的算法包
|
|
|
+ 3. 安装postgresql数据库
|
|
|
+ 4. 安装plpython3插件
|
|
|
以上是镜像文件构建的准备工作
|
|
|
|
|
|
## 构建镜像
|
|
@@ -713,8 +725,8 @@
|
|
|
mkdir -p /var/lib/postgresql/data
|
|
|
docker run -d -e POSTGRES_PASSWORD=123456 --name pg12 -v /var/lib/postgresql/data:/var/lib/postgresql/data -p 5432:5432 mypg:1 postgres
|
|
|
|
|
|
- -d表示后台执行
|
|
|
- -e表示设置环境变量(此处未pg数据库密码)
|
|
|
+ -d表示后台执行 (容器有个特性, 如果你run容器时执行的命令结束的话, 容器则自动结束)
|
|
|
+ -e表示设置环境变量(此处为pg数据库密码)
|
|
|
--name是给容器起一个名字pg12
|
|
|
-p 表示端口映射(本机端口:容器端口)
|
|
|
-v 表示文件夹映射(本机目录:容器目录) 此处表示postgresql的数据文件存放目录放在本机中, 即便换了容器, 数据也是不变
|
|
@@ -749,6 +761,7 @@
|
|
|
docker exec -it pg12 /bin/bash
|
|
|
(帮助: docker exec --help)
|
|
|
7. 退出容器
|
|
|
+ exit/quit
|
|
|
ctrl + P + Q
|
|
|
|
|
|
## 导出和载入镜像
|