{"id":4220,"date":"2024-11-11T16:52:13","date_gmt":"2024-11-11T08:52:13","guid":{"rendered":"https:\/\/fwq.ai\/blog\/4220\/"},"modified":"2024-11-11T16:52:13","modified_gmt":"2024-11-11T08:52:13","slug":"%e5%b0%86-r-%e5%ba%94%e7%94%a8%e7%a8%8b%e5%ba%8f%e5%ae%b9%e5%99%a8%e5%8c%96","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/4220\/","title":{"rendered":"\u5c06 R \u5e94\u7528\u7a0b\u5e8f\u5bb9\u5668\u5316"},"content":{"rendered":"<h1>\u5c06 R \u5e94\u7528\u7a0b\u5e8f\u5bb9\u5668\u5316<\/h1>\n<h2><\/h2>\n<ul>\n<li>\u4f60\u6709\u4e00\u4e2a \u3002\u672c\u8282\u4e2d\u7684\u793a\u4f8b\u4f7f\u7528\u57fa\u4e8e\u547d\u4ee4\u884c\u7684 git \u5ba2\u6237\u7aef\uff0c\u4f46\u60a8\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u5ba2\u6237\u7aef\u3002<\/li>\n<\/ul>\n<h2><\/h2>\n<p>\u672c\u90e8\u5206\u5c06\u5f15\u5bfc\u60a8\u5b8c\u6210\u5bb9\u5668\u5316\u548c\u8fd0\u884c R \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<h2><\/h2>\n<p>\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u6d41\u884c\u7684 \u6846\u67b6\u3002<\/p>\n<p>\u514b\u9686\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u4ee5\u4e0e\u672c\u6307\u5357\u4e00\u8d77\u4f7f\u7528\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u5c06\u76ee\u5f55\u66f4\u6539\u4e3a\u60a8\u60f3\u8981\u5de5\u4f5c\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u514b\u9686\u5b58\u50a8\u5e93\uff1a<\/p>\n<p><span> <\/span><br \/>\n<span> <\/span> <\/p>\n<pre><code><span><span><span>$<\/span> git clone https:\/\/github.com\/mfranzon\/r-docker-dev.git <\/span><\/span><\/code><\/pre>\n<p>\u60a8\u7684\u76ee\u5f55\u4e2d\u73b0\u5728\u5e94\u8be5\u6709\u4ee5\u4e0b\u5185\u5bb9<code>r-docker<\/code> \u3002<\/p>\n<p><span> <\/span><br \/>\n<span> <\/span> <\/p>\n<pre><code><span><span>\u251c\u2500\u2500 r-docker\/ <\/span><\/span><span><span>\u2502 \u251c\u2500\u2500 src\/ <\/span><\/span><span><span>\u2502 \u2502 \u2514\u2500\u2500 app.R <\/span><\/span><span><span>\u2502 \u251c\u2500\u2500 src_db\/ <\/span><\/span><span><span>\u2502 \u2502 \u2514\u2500\u2500 app_db.R <\/span><\/span><span><span>\u2502 \u251c\u2500\u2500 compose.yaml <\/span><\/span><span><span>\u2502 \u251c\u2500\u2500 Dockerfile <\/span><\/span><span><span>\u2502 \u2514\u2500\u2500 README.md<\/span><\/span><\/code><\/pre>\n<p>\u8981\u4e86\u89e3\u6709\u5173\u5b58\u50a8\u5e93\u4e2d\u7684\u6587\u4ef6\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<ul>\n<li><\/li>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<h2><\/h2>\n<p>\u5728\u76ee\u5f55\u5185<code>r-docker<\/code>\uff0c\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<p><span> <\/span><br \/>\n<span> <\/span> <\/p>\n<pre><code><span><span><span>$<\/span> docker compose up --build <\/span><\/span><\/code><\/pre>\n<p>\u67e5\u770b\u5e94\u7528\u7a0b\u5e8f \u3002\u60a8\u5e94\u8be5\u770b\u5230\u4e00\u4e2a\u7b80\u5355\u7684 Shiny \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\uff0c\u6309<code>ctrl<\/code>+<code>c<\/code>\u505c\u6b62\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<h3><\/h3>\n<p>\u60a8\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u9009\u9879\u6765\u8fd0\u884c\u4e0e\u7ec8\u7aef\u5206\u79bb\u7684\u5e94\u7528\u7a0b\u5e8f<code>-d<\/code> \u3002\u5728\u76ee\u5f55\u5185<code>r-docker<\/code>\uff0c\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<p><span> <\/span><br \/>\n<span> <\/span> <\/p>\n<pre><code><span><span><span>$<\/span> docker compose up --build -d <\/span><\/span><\/code><\/pre>\n<p>\u67e5\u770b\u5e94\u7528\u7a0b\u5e8f \u3002<\/p>\n<p>\u60a8\u5e94\u8be5\u770b\u5230\u4e00\u4e2a\u7b80\u5355\u7684 Shiny \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u505c\u6b62\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p><span> <\/span><br \/>\n<span> <\/span> <\/p>\n<pre><code><span><span><span>$<\/span> docker compose down <\/span><\/span><\/code><\/pre>\n<p>\u6709\u5173 Compose \u547d\u4ee4\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605 \u3002<\/p>\n<h2><\/h2>\n<p>\u5728\u672c\u90e8\u5206\u4e2d\uff0c\u60a8\u4e86\u89e3\u4e86\u5982\u4f55\u4f7f\u7528 Docker \u5bb9\u5668\u5316\u548c\u8fd0\u884c R \u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n<p>\u76f8\u5173\u4fe1\u606f\uff1a<\/p>\n<ul>\n<li><\/li>\n<li><\/li>\n<\/ul>\n<h2><\/h2>\n<p>\u5728\u4e0b\u4e00\u8282\u4e2d\uff0c\u60a8\u5c06\u4e86\u89e3\u5982\u4f55\u4f7f\u7528\u5bb9\u5668\u5f00\u53d1\u5e94\u7528\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c06 R \u5e94\u7528\u7a0b\u5e8f\u5bb9\u5668\u5316 \u4f60\u6709\u4e00\u4e2a \u3002\u672c\u8282\u4e2d\u7684\u793a\u4f8b\u4f7f\u7528\u57fa\u4e8e\u547d\u4ee4\u884c\u7684 git \u5ba2\u6237\u7aef\uff0c\u4f46\u60a8\u53ef\u4ee5\u4f7f\u7528\u4efb\u4f55\u5ba2\u6237\u7aef\u3002 \u672c\u90e8\u5206\u5c06\u5f15\u5bfc\u60a8\u5b8c\u6210\u5bb9\u5668\u5316\u548c\u8fd0\u884c R \u5e94\u7528\u7a0b\u5e8f\u3002 \u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528\u6d41\u884c\u7684 \u6846\u67b6\u3002 \u514b\u9686\u793a\u4f8b\u5e94\u7528\u7a0b\u5e8f\u4ee5\u4e0e\u672c\u6307\u5357\u4e00\u8d77\u4f7f\u7528\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u5c06\u76ee\u5f55\u66f4\u6539\u4e3a\u60a8\u60f3\u8981\u5de5\u4f5c\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u514b\u9686\u5b58\u50a8\u5e93\uff1a $ git clone https:\/\/github.com\/mfranzon\/r-docker-dev.git \u60a8\u7684\u76ee\u5f55\u4e2d\u73b0\u5728\u5e94\u8be5\u6709\u4ee5\u4e0b\u5185\u5bb9r-docker \u3002 \u251c\u2500\u2500 r-docker\/ \u2502 \u251c\u2500\u2500 src\/ \u2502 \u2502 \u2514\u2500\u2500 app.R \u2502 \u251c\u2500\u2500 src_db\/ \u2502 \u2502 \u2514\u2500\u2500 app_db.R \u2502 \u251c\u2500\u2500 compose.yaml \u2502 \u251c\u2500\u2500 Dockerfile \u2502 \u2514\u2500\u2500 README.md \u8981\u4e86\u89e3\u6709\u5173\u5b58\u50a8\u5e93\u4e2d\u7684\u6587\u4ef6\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u4ee5\u4e0b\u5185\u5bb9\uff1a \u5728\u76ee\u5f55\u5185r-docker\uff0c\u5728\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002 $ docker compose up &#8211;build \u67e5\u770b\u5e94\u7528\u7a0b\u5e8f \u3002\u60a8\u5e94\u8be5\u770b\u5230\u4e00\u4e2a\u7b80\u5355\u7684 Shiny \u5e94\u7528\u7a0b\u5e8f\u3002 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-4220","post","type-post","status-publish","format-standard","hentry","category-docker"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=4220"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/4220\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=4220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=4220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=4220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}