{"id":206279,"date":"2025-06-12T10:09:55","date_gmt":"2025-06-12T02:09:55","guid":{"rendered":"https:\/\/server.hk\/cnblog\/206279\/"},"modified":"2025-06-12T10:09:55","modified_gmt":"2025-06-12T02:09:55","slug":"micro-v3-%e4%b8%ad%e7%9a%84-dockerfile-%e5%bc%95%e7%94%a8%e4%ba%86-helloworld-srv-%e6%96%87%e4%bb%b6%ef%bc%8c%e8%bf%99%e4%b8%aa%e6%96%87%e4%bb%b6%e4%bb%8e%e5%93%aa%e9%87%8c%e6%9d%a5%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/206279\/","title":{"rendered":"Micro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f"},"content":{"rendered":"<p>GOLANG\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765<br \/>\n<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aMicro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f\u300b<\/span>\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<br \/>\n<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60<br \/>\n<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">GOLANG<\/span>\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01,<br \/>\n<img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241108\/1731046171672dab1bafc2e.jpg\" class=\"aligncenter\">,<br \/>\n<strong>\u5728 go \u5fae\u670d\u52a1\u6846\u67b6 micro \u4e2d\u7406\u89e3 dockerfile<\/strong>,<br \/>\n<strong>\u95ee\u9898\uff1a<\/strong>,\u5728 micro v3 github \u4ed3\u5e93\u7684 dockerfile \u4e2d\uff0c\u6709\u4e00\u4e2a\u5f15\u7528\u540d\u4e3a helloworld-srv \u7684\u6587\u4ef6\uff0c\u4f46\u63d0\u95ee\u8005\u5728\u672c\u5730\u627e\u4e0d\u5230\u8be5\u6587\u4ef6\u3002\u8be5\u6587\u4ef6\u662f\u4ece\u4f55\u4ea7\u751f\u7684\uff1f,<br \/>\n<strong>\u89e3\u7b54\uff1a<\/strong>,\u4ece\u63d0\u95ee\u8005\u63d0\u4f9b\u7684\u80cc\u666f\u4fe1\u606f\u6765\u770b\uff0chelloworld-srv \u662f\u4f7f\u7528 micro \u7684 micro new \u547d\u4ee4\u751f\u6210\u7684\u3002\u6b64\u547d\u4ee4\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684 micro \u5fae\u670d\u52a1\uff0c\u5e76\u751f\u6210\u4e86\u51e0\u4e2a\u6587\u4ef6\uff0c\u5305\u62ec helloworld-srv\u3002,<br \/>\n<strong>dockerfile \u4e2d\u7684\u5f15\u7528\uff1a<\/strong>,dockerfile \u4e2d\u7684\u5f15\u7528\u5982\u4e0b\uff1a,\u8fd9\u610f\u5473\u7740 dockerfile \u6b63\u5728\u5c06\u672c\u5730 helloworld-srv \u53ef\u6267\u884c\u6587\u4ef6\u590d\u5236\u5230 docker \u955c\u50cf\uff0c\u5e76\u5728\u5bb9\u5668\u542f\u52a8\u65f6\u6267\u884c\u6b64\u53ef\u6267\u884c\u6587\u4ef6\u3002,<br \/>\n<strong>\u751f\u6210 helloworld-srv \u6587\u4ef6\uff1a<\/strong>,\u8981\u751f\u6210 helloworld-srv \u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b micro new \u547d\u4ee4\uff1a,\u6b64\u547d\u4ee4\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 micro \u670d\u52a1\uff0c\u5176\u4e2d\u5305\u542b\u540d\u4e3a helloworld-srv \u7684 main \u670d\u52a1\u6587\u4ef6\u3002\u6b64\u6587\u4ef6\u8d1f\u8d23\u5904\u7406 http \u8bf7\u6c42\u5e76\u63d0\u4f9b\u9884\u5b9a\u4e49\u7684\u54cd\u5e94\u3002,\u4eca\u5929\u5173\u4e8e\u300aMicro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8GOLANG\u516c\u4f17\u53f7\uff01,\u5728 go \u5fae\u670d\u52a1\u6846\u67b6 micro \u4e2d\u7406\u89e3 dockerfile,GOLANG\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765<br \/>\n<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aMicro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f\u300b<\/span>\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<br \/>\n<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60<br \/>\n<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">GOLANG<\/span>\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01,<br \/>\n<b><\/b> <\/p>\n<p>\u5f53\u524d\u4f4d\u7f6e\uff1a <span>&gt;<\/span>  <span>&gt;<\/span>  <span>&gt;<\/span>  <span>&gt;<\/span> <span>Micro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f<\/span><\/p>\n<h1>Micro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f<\/h1>\n<p><span>2024-11-08 14:09:47<\/span><br \/>\n<span><i><\/i>0\u6d4f\u89c8<\/span><br \/>\n<span style=\"cursor: pointer\"><i><\/i>\u6536\u85cf<\/span> <\/p>\n<p>GOLANG\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">\u300aMicro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f\u300b<\/span>\uff0c\u611f\u5174\u8da3\u7684\u670b\u53cb\u8bf7\u7ee7\u7eed\u770b\u4e0b\u53bb\u5427\uff01\u4ee5\u4e0b\u5185\u5bb9\u5c06\u4f1a\u6d89\u53ca\u5230<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\"><\/span>\u7b49\u7b49\u77e5\u8bc6\u70b9\uff0c\u5982\u679c\u4f60\u662f\u6b63\u5728\u5b66\u4e60<span style=\"color: #FF6600;, Helvetica, Arial, sans-serif;font-size: 14px;background-color: #FFFFFF\">GOLANG<\/span>\u6216\u8005\u5df2\u7ecf\u662f\u5927\u4f6c\u7ea7\u522b\u4e86\uff0c\u90fd\u975e\u5e38\u6b22\u8fce\u4e5f\u5e0c\u671b\u5927\u5bb6\u90fd\u80fd\u7ed9\u6211\u5efa\u8bae\u8bc4\u8bba\u54c8~\u5e0c\u671b\u80fd\u5e2e\u52a9\u5230\u5927\u5bb6\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.17golang.com\/uploads\/20241108\/1731046171672dab1bafc2e.jpg\" class=\"aligncenter\"><\/p>\n<p><strong>\u5728 go \u5fae\u670d\u52a1\u6846\u67b6 micro \u4e2d\u7406\u89e3 dockerfile<\/strong><\/p>\n<p><strong>\u95ee\u9898\uff1a<\/strong><\/p>\n<p>\u5728 micro v3 github \u4ed3\u5e93\u7684 dockerfile \u4e2d\uff0c\u6709\u4e00\u4e2a\u5f15\u7528\u540d\u4e3a helloworld-srv \u7684\u6587\u4ef6\uff0c\u4f46\u63d0\u95ee\u8005\u5728\u672c\u5730\u627e\u4e0d\u5230\u8be5\u6587\u4ef6\u3002\u8be5\u6587\u4ef6\u662f\u4ece\u4f55\u4ea7\u751f\u7684\uff1f<\/p>\n<p><strong>\u89e3\u7b54\uff1a<\/strong><\/p>\n<p>\u4ece\u63d0\u95ee\u8005\u63d0\u4f9b\u7684\u80cc\u666f\u4fe1\u606f\u6765\u770b\uff0chelloworld-srv \u662f\u4f7f\u7528 micro \u7684 micro new \u547d\u4ee4\u751f\u6210\u7684\u3002\u6b64\u547d\u4ee4\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684 micro \u5fae\u670d\u52a1\uff0c\u5e76\u751f\u6210\u4e86\u51e0\u4e2a\u6587\u4ef6\uff0c\u5305\u62ec helloworld-srv\u3002<\/p>\n<p><strong>dockerfile \u4e2d\u7684\u5f15\u7528\uff1a<\/strong><\/p>\n<p>dockerfile \u4e2d\u7684\u5f15\u7528\u5982\u4e0b\uff1a<\/p>\n<pre>copy .\/helloworld-srv \/helloworld-srv\ncmd [\"helloworld-srv\"]<\/pre>\n<p>\u8fd9\u610f\u5473\u7740 dockerfile \u6b63\u5728\u5c06\u672c\u5730 helloworld-srv \u53ef\u6267\u884c\u6587\u4ef6\u590d\u5236\u5230 docker \u955c\u50cf\uff0c\u5e76\u5728\u5bb9\u5668\u542f\u52a8\u65f6\u6267\u884c\u6b64\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p><strong>\u751f\u6210 helloworld-srv \u6587\u4ef6\uff1a<\/strong><\/p>\n<p>\u8981\u751f\u6210 helloworld-srv \u6587\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b micro new \u547d\u4ee4\uff1a<\/p>\n<pre>micro new helloworld-srv<\/pre>\n<p>\u6b64\u547d\u4ee4\u5c06\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 micro \u670d\u52a1\uff0c\u5176\u4e2d\u5305\u542b\u540d\u4e3a helloworld-srv \u7684 main \u670d\u52a1\u6587\u4ef6\u3002\u6b64\u6587\u4ef6\u8d1f\u8d23\u5904\u7406 http \u8bf7\u6c42\u5e76\u63d0\u4f9b\u9884\u5b9a\u4e49\u7684\u54cd\u5e94\u3002<\/p>\n<p>\u4eca\u5929\u5173\u4e8e\u300aMicro v3 \u4e2d\u7684 Dockerfile \u5f15\u7528\u4e86 helloworld-srv \u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4ece\u54ea\u91cc\u6765\uff1f\u300b\u7684\u5185\u5bb9\u5c31\u4ecb\u7ecd\u5230\u8fd9\u91cc\u4e86\uff0c\u662f\u4e0d\u662f\u5b66\u8d77\u6765\u4e00\u76ee\u4e86\u7136\uff01\u60f3\u8981\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u7684\u5185\u5bb9\u8bf7\u5173\u6ce8GOLANG\u516c\u4f17\u53f7\uff01<\/p>\n<dl>\n<dt>\n <\/dt>\n<dd>\n   \u5982\u4f55\u4f7f\u7528 Vue Router \u5728 JavaScript \u4e2d\u5b9e\u73b0 History \u8def\u7531\uff1f\n <\/dd>\n<\/dl>\n<dl>\n<dt>\n <\/dt>\n<dd>\n   \u5982\u4f55\u5728HTML\u4e2d\u4f7f\u7528data-callback\u83b7\u53d6\u4ee4\u724c\uff1f\n <\/dd>\n<\/dl>\n","protected":false},"excerpt":{"rendered":"<p>GOLANG\u4eca\u5929\u5c06\u7ed9\u5927\u5bb6\u5e26\u6765 \u300a&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-206279","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/206279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=206279"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/206279\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=206279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=206279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=206279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}