{"action":"created","issue":{"url":"https://api.github.com/repos/DXY-F2E/api-mocker/issues/37","repository_url":"https://api.github.com/repos/DXY-F2E/api-mocker","labels_url":"https://api.github.com/repos/DXY-F2E/api-mocker/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/DXY-F2E/api-mocker/issues/37/comments","events_url":"https://api.github.com/repos/DXY-F2E/api-mocker/issues/37/events","html_url":"https://github.com/DXY-F2E/api-mocker/pull/37","id":295047282,"node_id":"MDExOlB1bGxSZXF1ZXN0MTY3NjI2NDI4","number":37,"title":"增加Docker支持","user":{"login":"Qquanwei","id":9263655,"node_id":"MDQ6VXNlcjkyNjM2NTU=","avatar_url":"https://avatars3.githubusercontent.com/u/9263655?v=4","gravatar_id":"","url":"https://api.github.com/users/Qquanwei","html_url":"https://github.com/Qquanwei","followers_url":"https://api.github.com/users/Qquanwei/followers","following_url":"https://api.github.com/users/Qquanwei/following{/other_user}","gists_url":"https://api.github.com/users/Qquanwei/gists{/gist_id}","starred_url":"https://api.github.com/users/Qquanwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qquanwei/subscriptions","organizations_url":"https://api.github.com/users/Qquanwei/orgs","repos_url":"https://api.github.com/users/Qquanwei/repos","events_url":"https://api.github.com/users/Qquanwei/events{/privacy}","received_events_url":"https://api.github.com/users/Qquanwei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-07T08:31:10Z","updated_at":"2018-11-13T07:58:26Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/DXY-F2E/api-mocker/pulls/37","html_url":"https://github.com/DXY-F2E/api-mocker/pull/37","diff_url":"https://github.com/DXY-F2E/api-mocker/pull/37.diff","patch_url":"https://github.com/DXY-F2E/api-mocker/pull/37.patch"},"body":"目前项目内的配置缺少有关docker的，所以需要修改部分配置才可以运行。\r\n\r\n跑docker前需要修改 client/config/index.js, 将ip替换成跑docker宿主vm地址\r\n```\r\n build.serverRoot: '192.168.99.100/mock-api'\r\n```\r\n\r\n## 编译docker镜像\r\n\r\n```\r\n> cd client\r\n> npm install\r\n> cd ..\r\n> npm run docker:build\r\n```\r\n\r\n## 运行docker容器\r\n\r\n```\r\n> npm run docker:start\r\n# client 8888 server 7001\r\n# open 192.168.99.100:8888\r\n```\r\n\r\n然后打开docker vm ip:8888即可\r\nwin/mac 下一般默认的docker vm ip为 192.168.99.100.\r\n\r\n\r\n目前的不足.\r\n\r\n* mongod 现在默认连接地址为 127.0.0.1 ， 导致docker只能通过共享network namespace来连接两个容器，这样不利于容器的独立 也不利于分布式数据库的部署。 建议server端连接 mongodb://api-mongo:27017\r\n给mongo分配一个独立的域名连接，因为mongo总是运行在内网环境，所以只需部署机增加host映射即可。好处是可以动态更换ip，方便docker部署。\r\n\r\n* client/config/index.js 这里的动态ip可能无法适应目前的环境，如果能静态编译时生成ip最好了。\r\n"},"comment":{"url":"https://api.github.com/repos/DXY-F2E/api-mocker/issues/comments/438171054","html_url":"https://github.com/DXY-F2E/api-mocker/pull/37#issuecomment-438171054","issue_url":"https://api.github.com/repos/DXY-F2E/api-mocker/issues/37","id":438171054,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODE3MTA1NA==","user":{"login":"wuomzfx","id":8017237,"node_id":"MDQ6VXNlcjgwMTcyMzc=","avatar_url":"https://avatars3.githubusercontent.com/u/8017237?v=4","gravatar_id":"","url":"https://api.github.com/users/wuomzfx","html_url":"https://github.com/wuomzfx","followers_url":"https://api.github.com/users/wuomzfx/followers","following_url":"https://api.github.com/users/wuomzfx/following{/other_user}","gists_url":"https://api.github.com/users/wuomzfx/gists{/gist_id}","starred_url":"https://api.github.com/users/wuomzfx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wuomzfx/subscriptions","organizations_url":"https://api.github.com/users/wuomzfx/orgs","repos_url":"https://api.github.com/users/wuomzfx/repos","events_url":"https://api.github.com/users/wuomzfx/events{/privacy}","received_events_url":"https://api.github.com/users/wuomzfx/received_events","type":"User","site_admin":false},"created_at":"2018-11-13T07:58:26Z","updated_at":"2018-11-13T07:58:26Z","author_association":"CONTRIBUTOR","body":"nobody"}}
{"actor":{"display_login":"wuomzfx"}}