{"id":33970,"date":"2023-11-23T23:38:57","date_gmt":"2023-06-30T10:07:19","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/"},"modified":"2024-05-04T10:29:37","modified_gmt":"2024-05-04T02:29:37","slug":"%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/","title":{"rendered":"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot"},"content":{"rendered":"<p>\u6709\u4e00\u4e2a\u540d\u4e3aHubot\u7684\u804a\u5929\u673a\u5668\u4eba\u5f00\u53d1\u548c\u6267\u884c\u6846\u67b6\u3002<br \/>\n\u5b83\u5728Node.js\u4e0a\u8fd0\u884c\uff0c\u6240\u4ee5\u53ea\u8981\u5c06\u5176\u90e8\u7f72\u5230Heroku\u6216\u9002\u5f53\u7684\u670d\u52a1\u5668\u4e0a\u5373\u53ef\uff0c\u4f46\u662f\u6211\u60f3\u8d81\u673a\u5b66\u4e60\u4e00\u4e0b\uff0c\u6240\u4ee5\u6253\u7b97\u5c06\u5176\u90e8\u7f72\u5230Docker\u4e0a\u3002<br \/>\n\u6b64\u5916\uff0c\u56e0\u4e3a\u6211\u5728GitLab\u4e0a\u7ba1\u7406\u4e86\u673a\u5668\u4eba\u7684\u6e90\u4ee3\u7801\uff0c\u6240\u4ee5\u6211\u5e0c\u671b\u5c06\u5176\u63a8\u9001\u5230GitLab\u540e\uff0c\u80fd\u591f\u81ea\u52a8\u90e8\u7f72\u5230Docker\u3002<\/p>\n<h2>\u6574\u4f53\u5f62\u8c61<\/h2>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/2-0.png\" alt=\"\u5168\u4f53\u50cf.png\" \/><\/div>\n<p>GitLab-Runner\u3001Build VM\u3001HomeBot\u3001Redis\u5728Docker\u4e0a\u8fd0\u884c\u3002<br \/>\nHomeBot\u662f\u7528Hubot\u521b\u5efa\u7684\u673a\u5668\u4eba\uff0c\u5728GitLab\u4e0a\u8fdb\u884c\u6e90\u4ee3\u7801\u7ba1\u7406\u3002<br \/>\n\u8fd0\u884c\u5728Docker\u4e0a\u7684GitLab-Runner\u4f1a\u542f\u52a8Build VM\uff0c\u5e76\u5728Docker\u4e0a\u542f\u52a8homebot\u548cRedis\u3002<br \/>\n\u76f4\u89c2\u5730\u8bf4\uff0c\u8fd9\u5c31\u50cf\u4e00\u4e2a\u4e09\u5c42Docker in Docker in Docker\u7684\u7ed3\u6784\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/4-0.png\" alt=\"3\u968e\u5efa\u3066.png\" \/><\/div>\n<p>\u53ea\u662f\uff0c\u7531\u4e8e\u6784\u5efaVM\u5728\u6784\u5efa\u5b8c\u6210\u540e\u4f1a\u5d29\u6e83\uff0c\u6240\u4ee5\u65e0\u6cd5\u5c06homebot\u548cRedis\u5b89\u7f6e\u5728\u8fd9\u91cc\uff0c\u56e0\u4e3a\u5b83\u4eec\u9700\u8981\u6301\u7eed\u8fd0\u884c\u3002<br \/>\n\uff08\u4e5f\u8bb8\u6709\u5176\u4ed6\u65b9\u6cd5\u5417\uff1f\uff09<\/p>\n<p>\u901a\u8fc7\u4f7f\u7528\u4e00\u79cd\u540d\u4e3aDocker in Docker\u7684\u673a\u5236\uff0c\u53ef\u4ee5\u4eceDocker\u5bb9\u5668\u4e2d\u8c03\u7528\u5bbf\u4e3b\u673a\u4e0a\u7684Docker\u529f\u80fd\uff0c<br \/>\n\u4f7f\u7528Docker\u4e2d\u7684Build VM\u5c06homebot\u548cRedis\u90e8\u7f72\u5230\u5bbf\u4e3b\u673a\u7684Docker\u4e0a\u3002<br \/>\n\u540c\u65f6\uff0c\u51b3\u5b9a\u5c06Build VM\u4e5f\u5728\u5bbf\u4e3b\u673a\u7684Docker\u4e0a\u8fd0\u884c\uff0c\u6700\u7ec8\u5b9e\u9645\u60c5\u51b5\u5982\u4e0b\u6240\u793a\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/7-0.png\" alt=\"\u6a2a\u4e26\u3073.png\" \/><\/div>\n<h2>\u7a0d\u5fae\u79bb\u9898\u4e00\u4e0b<\/h2>\n<p>\u8fd9\u91cc\u5236\u4f5c\u7684Bot\u662f\u4f7f\u7528\u667a\u80fd\u97f3\u7bb1Google Home\u6765\u63a7\u5236\u7167\u660e\u548c\u7a7a\u8c03\u7684\u8bbe\u5907\u3002\u57fa\u7840\u90e8\u5206\u662f\u53c2\u8003\u4e86\u8fd9\u4e2a\u7f51\u7ad9\u3002<\/p>\n<p>\u667a\u80fd\u5bb6\u5c45 &#8211; \u5e9f\u7269\u7bb1<\/p>\n<p>\u5982\u679c\u60a8\u5bf9\u8fd9\u7c7b\u4e8b\u60c5\u611f\u5174\u8da3\u7684\u8bdd\uff0c\u4e0d\u59a8\u6765\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\u3002<\/p>\n<h2>\u524d\u63d0\u6761\u4ef6 (Qian ti tiao jian)<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitLab ver.9.1.3<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitLab-runner ver.10.5.0<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Docker ver.18.03.0-ce<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">Hubot ver.2.19<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Redis ver.4.0.8<\/ul>\n<h2>\u6e96\u5099Hubot\u958b\u767a\u74b0\u5883\u548cGitLab\u5b58\u50a8\u5e93\u3002<\/h2>\n<p>\u8bf7\u53c2\u8003\u5916\u90e8\u7f51\u7ad9\u51c6\u5907Hubot\u7684\u73af\u5883\u3002<br \/>\n\u6211\u8ba4\u4e3a\u4e0d\u9700\u8981\u7279\u522b\u89e3\u91ca\uff0c\u4f46\u8bf7\u5728GitLab\u4e0a\u521b\u5efa\u5b58\u50a8\u5e93\u5e76\u8fdb\u884c\u63a8\u9001\u3002<\/p>\n<p>Hubot\u7684\u5f00\u53d1\u73af\u5883\u914d\u7f6e\u6587\u4ef6\u5e94\u8be5\u662f\u8fd9\u6837\u7684\u3002<\/p>\n<pre class=\"post-pre\"><code>root\r\n\u251c bin\r\n\u251c lib\r\n\u251c scripts\r\n\u251c .gitignore\r\n\u251c .hubot_history\r\n\u251c external-scripts.json\r\n\u251c package.json\r\n\u251c Procfile\r\n\u2514 README.md\r\n<\/code><\/pre>\n<h2>\u51c6\u5907 Dockerfile<\/h2>\n<p>\u5c06\u7528\u4e8e\u6784\u5efa Bot \u8fd0\u884c\u7684 Docker \u955c\u50cf\u7684 Dockerfile \u6dfb\u52a0\u5230\u4ed3\u5e93\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code>root\r\n\u251c bin\r\n\u251c lib\r\n\u251c scripts\r\n\u251c .gitignore\r\n\u251c .hubot_history\r\n\u251c dockerfile          &lt;-NEW!!\r\n\u251c external-scripts.json\r\n\u251c package.json\r\n\u251c Procfile\r\n\u2514 README.md\r\n<\/code><\/pre>\n<p>Dockerfile\u7684\u610f\u601d\u662f\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\uff0c\u5b83\u5305\u542b\u4e00\u7cfb\u5217\u7684\u547d\u4ee4\u548c\u6307\u4ee4\uff0c\u7528\u4e8e\u5728Docker\u5bb9\u5668\u4e2d\u6784\u5efa\u548c\u914d\u7f6e\u955c\u50cf\u3002<\/p>\n<pre class=\"post-pre\"><code>FROM centos\r\n\r\nRUN yum -y update\r\nRUN yum -y install epel-release\r\nRUN yum -y install git nodejs npm\r\n\r\nCOPY . \/app\/bot\/homebot\r\nWORKDIR \/app\/bot\/homebot\r\nRUN npm install\r\nCMD sh \/app\/bot\/homebot\/bin\/hubot -a slack\r\n<\/code><\/pre>\n<p>\u5728Docker Build\u4e2d\uff0c\u6211\u6ca1\u6709\u505a\u592a\u591a\u7684\u4e8b\u60c5\u3002<br \/>\n\u53ea\u662f\u9009\u62e9\u4e86 centos \u955c\u50cf\u4f5c\u4e3a\u57fa\u7840\uff08\u6ca1\u6709\u7279\u522b\u7684\u542b\u4e49\uff0c\u53ea\u662f\u4e2a\u4eba\u559c\u597d\uff09\uff0c<br \/>\n\u7136\u540e\u83b7\u53d6\u4e86 git\u3001nodejs \u548c npm\uff0c\u5728\u4ed3\u5e93\u91cc\u5c06\u5176\u914d\u7f6e\u5230 \/app\/bot\/homebot\uff0c<br \/>\n\u5e76\u8fdb\u884c npm install \u5b89\u88c5\u3002<br \/>\n\u8fd0\u884c\u65f6\u53ea\u9700\u8981\u542f\u52a8 Hubot \u5373\u53ef\u3002<\/p>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u5e94\u8be5\u5df2\u7ecf\u80fd\u591f\u8fdb\u884c\u624b\u52a8\u90e8\u7f72\u4e86\u3002<\/p>\n<p>\u6211\u4f1a\u5728Docker\u4e3b\u673a\u4e0a\u514b\u9686Git\u5e76\u786e\u8ba4\u6784\u5efa\u6210\u529f\u3002<\/p>\n<pre class=\"post-pre\"><code># cd \u9069\u5f53\u306a\u30d5\u30a9\u30eb\u30c0\r\n# git clone http:\/\/GitLab\u306e\u30ea\u30dd\u30b8\u30c8\u30eaURL\r\n# cd \u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u30d5\u30a9\u30eb\u30c0\r\n# docker build -t homebot .\/\r\n<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u6784\u5efa\u7684\u955c\u50cf\u542f\u52a8Hubot\uff0c\u5e76\u9a8c\u8bc1\u5df2\u5b9e\u65bd\u7684\u54cd\u5e94\u3002<\/p>\n<pre class=\"post-pre\"><code># docker run --rm -it -w \/app\/bot\/homebot\/ homebot sh \/app\/bot\/homebot\/bin\/hubot\r\nhomebot&gt; [Mon Mar 26 2018 13:02:49 GMT+0000 (UTC)] INFO hubot-redis-brain: Using default redis on localhost:6379\r\n\r\nhomebot&gt; homebot ping\r\nhomebot&gt; PONG\r\nhomebot&gt; exit\r\n<\/code><\/pre>\n<h2>GitLab Runner\u7684\u51c6\u5907\u5de5\u4f5c<\/h2>\n<p>\u4e3a\u4e86\u8fdb\u884cDocker\u4e2d\u7684Docker\u64cd\u4f5c\uff0c<br \/>\n\u9700\u8981\u5728\u542f\u52a8\u7684Docker\u5bb9\u5668\u5185\u6267\u884cDocker\u547d\u4ee4\u3002<br \/>\n\u56e0\u6b64\uff0c\u9700\u8981\u4e8b\u5148\u51c6\u5907\u597dDocker\u5ba2\u6237\u7aef\u3002<\/p>\n<pre class=\"post-pre\"><code>mkdir -p \/root\/gitlab-runner\/bin\r\ncurl -fsSL https:\/\/get.docker.com\/builds\/Linux\/x86_64\/docker-17.05.0-ce.tgz  | tar -xzC \/root\/gitlab-runner\/bin\/ --strip=1 docker\/docker\r\n<\/code><\/pre>\n<p>\u83b7\u53d6Docker\u5ba2\u6237\u7aef\u8bf7\u53c2\u8003\u4ee5\u4e0b\u94fe\u63a5\uff1a<br \/>\nhttps:\/\/qiita.com\/minamijoyo\/items\/c937fb4f646dc1ff064a<\/p>\n<p>\u53e6\u5916\uff0c\u6253\u5f00GitLab\u5e76\u8bb0\u5f55\u4e0b\u7528\u4e8e\u6ce8\u518cgitlab-runner\u7684registration-token\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/34-0.png\" alt=\"GitLab-Runner-Regist-Token.png\" \/><\/div>\n<h2>\u542f\u52a8\u548c\u6ce8\u518cGitLab-Runner<\/h2>\n<p>GitLab-CI\u5c06\u79f0\u4e3aRunner\u7684CI\u6267\u884c\u5f15\u64ce\u5e38\u9a7b\u5728\u6267\u884cCI\u7684\u8ba1\u7b97\u673a\u4e0a\u3002<br \/>\n\u8fd9\u79cd\u673a\u5236\u4f7f\u5f97\u53ef\u4ee5\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fd0\u884c\u6784\u5efa\u4efb\u52a1\uff0c\u6216\u8005\u589e\u52a0CI\u670d\u52a1\u5668\u7684\u6570\u91cf\uff0c\u4ee5\u5b9e\u73b0\u7075\u6d3b\u7684\u64cd\u4f5c\u3002<\/p>\n<p>\u672c\u6b21\u6211\u4eec\u8981\u5c06GitLab Runner\u4e5f\u5728Docker\u4e0a\u8fd0\u884c\u5e76\u4fdd\u6301\u5e38\u9a7b\u72b6\u6001\u3002<br \/>\n\u9996\u5148\uff0c\u542f\u52a8gitlab-runner\u7684\u5b98\u65b9\u955c\u50cf\u3002<\/p>\n<pre class=\"post-pre\"><code> \u266f docker run -d \\\r\n    --name gitlab-runner-docker \\\r\n    -h gitlab-runnder \\\r\n    -v \/root\/gitlab-runner\/config:\/etc\/gitlab-runner \\\r\n    -v \/root\/gitlab-runner\/bin\/docker:\/usr\/local\/bin\/docker \\\r\n    -v \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\r\n    gitlab\/gitlab-runner \r\n<\/code><\/pre>\n<p>\u5173\u952e\u662f\u5c06\u4e09\u4e2a\u97f3\u91cf\u6302\u8f7d\u3002<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\/etc\/gitlab-runner<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">gitlab-runner\u306e\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u304c\u3053\u3053\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u30db\u30b9\u30c8\u306b\u30de\u30a6\u30f3\u30c8\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u30b3\u30f3\u30c6\u30ca\u3092\u4f5c\u308a\u76f4\u3057\u3066\u3082\u8a2d\u5b9a\u3092\u5fa9\u5143\u3067\u304d\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\/usr\/local\/bin\/docker<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4e0a\u3067\u53d6\u5f97\u3057\u305fdocker\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\/usr\/local\/bin\/docker\u306b\u914d\u7f6e\u3057\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\/var\/run\/docker.sock<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">Docker in Docker\u3067\u3001\u30db\u30b9\u30c8\u306eDocker\u3092\u64cd\u4f5c\u3059\u308b\u305f\u3081\u306bdocker.sock\u3092\u5171\u6709\u3057\u307e\u3059\u3002<\/ul>\n<p>\u5728\u542f\u52a8\u7684\u5bb9\u5668\u4e2d\u6267\u884cgitlab-runner register\u547d\u4ee4\uff0c\u5e76\u5c06\u5176\u6ce8\u518c\u5230GitLab\u4e2d\u3002<\/p>\n<pre class=\"post-pre\"><code> \u266f docker exec -it gitlab-runner-docker \\\r\n   gitlab-runner register --non-interactive \\\r\n  --url https:\/\/(GitLab\u306eURL)\/ci \\\r\n  --registration-token XXXXXXXXXXXXXXXXXX \\\r\n  --executor docker \\\r\n  --description \"Docker-in-Docker\" \\\r\n  --tag-list docker-in-docker \\\r\n  --docker-image \"docker\" \\\r\n  --docker-privileged \\\r\n  --docker-volumes \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\r\n  --docker-volumes \/root\/gitlab-runner\/bin\/docker:\/usr\/local\/bin\/docker\r\n<\/code><\/pre>\n<p>\u6bcf\u4e2a\u53c2\u6570\u7684\u503c\u5982\u4e0b:<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">url<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitLab\u306eURL\u3067\u3059\u3002\u300c\/ci\u300d\u306f\u4ed8\u3051\u3066\u3082\u4ed8\u3051\u306a\u304f\u3066\u3082\u3088\u3044\u3089\u3057\u3044\u3067\u3059\u304c\u3001\u4e00\u5fdc\u3064\u3051\u3066\u304a\u304d\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">registration-token<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u4e0a\u3067\u3001GitLab\u4e0a\u3067\u78ba\u8a8d\u3057\u305fregistration-token\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">executor<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">docker\u3092\u6307\u5b9a\u3057\u3066\u3001CI\u5b9f\u884c\u6642\u306b\u65b0\u305f\u306bdocker\u30b3\u30f3\u30c6\u30ca\u3092\u8d77\u52d5\u3057\u3066\u305d\u306e\u4e2d\u3067\u30d3\u30eb\u30c9\u3057\u307e\u3059\u3002\u4ed6\u306b\u3082\u76f4\u63a5\u30b7\u30a7\u30eb\u4e0a\u3067\u5b9f\u884c\u3059\u308bshell\u304c\u3088\u304f\u4f7f\u308f\u308c\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001docker\u304c\u304a\u3059\u3059\u3081\u3089\u3057\u3044\u306e\u3067\u3001\u305d\u3061\u3089\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">tag-list<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">\u5b9f\u884c\u3059\u308brunner\u3092\u9078\u3076\u305f\u3081\u306e\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u4f55\u3067\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001runner\u306e\u5b9f\u884c\u74b0\u5883\u306b\u3042\u3063\u305f\u540d\u524d\u304c\u826f\u3044\u3067\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">docker-*<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">runner\u304b\u3089\u8d77\u52d5\u3055\u308c\u308bdocker\u30b3\u30f3\u30c6\u30ca(=Build VM)\u306e\u60c5\u5831\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>docker-image<br \/>\n\u30c7\u30d5\u30a9\u30eb\u30c8\u306eDocker\u30a4\u30e1\u30fc\u30b8\u3067\u3001\u3053\u3053\u3067\u306f\u57fa\u672c\u7684\u306bgitlab-ci.yml\u3067\u6307\u5b9a\u3059\u308b\u306e\u3067\u9069\u5f53\u306b\u3002<br \/>\ndocker-privileged<br \/>\nBuild VM\u306f\u7279\u6a29\u30e2\u30fc\u30c9\u3067\u8d77\u52d5\u3057\u307e\u3059\u3002\u3053\u308c\u306f\u3082\u3057\u304b\u3059\u308b\u3068\u4e0d\u8981\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br \/>\ndocker-volumes<br \/>\nrunner\u3092\u4f5c\u3063\u305f\u6642\u3068\u540c\u3058\u3067\u3059\u304c\u3001\u30db\u30b9\u30c8\u306edocker\u3092\u64cd\u4f5c\u3059\u308b\u305f\u3081\u306esock\u3068docker\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092\u914d\u7f6e\u3057\u307e\u3059\u3002<br \/>\n\u6ce8\u610f\u70b9\u3068\u3057\u3066\u306f\u3001docker in docker\u3068\u3044\u3063\u3066\u3082\u3001\u30de\u30a6\u30f3\u30c8\u3059\u308b\u30dc\u30ea\u30e5\u30fc\u30e0\u306fBuild VM\u306e\u30d1\u30b9\u3067\u306f\u306a\u304f\u3001\u30db\u30b9\u30c8\u306e\u30d1\u30b9\u306b\u306a\u308b\u70b9\u3067\u3059\u3002<\/p>\n<p>\u6253\u5f00GitLab\uff0c\u5e76\u786e\u8ba4\u662f\u5426\u5df2\u6ce8\u518crunner\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/46-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u6700\u540e\uff0c\u6253\u5f00\u521a\u624d\u6ce8\u518c\u7684runner\u7684\u7f16\u8f91\u9009\u9879\uff0c\u5e76\u5c06\u5176\u5173\u8054\u5230GitLab\u7684\u5b58\u50a8\u5e93\u4e2d\u3002<br \/>\n\u867d\u7136\u6839\u636e\u8bbe\u7f6e\u53ef\u80fd\u4e0d\u9700\u8981\u8fd9\u6837\u505a\uff0c\u4f46\u4e3a\u4e86\u5b89\u5168\u8d77\u89c1\uff0c\u6211\u4eec\u5efa\u8bae\u624b\u52a8\u8fdb\u884c\u8be5\u914d\u7f6e\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/48-0.png\" alt=\"image.png\" \/><\/div>\n<h2>\u51c6\u5907\u90e8\u7f72<\/h2>\n<p>\u8981\u5c06Bot\u4e0eSlack\u8fdb\u884c\u8fde\u63a5\uff0c\u9700\u8981\u5728Slack\u4e0a\u6dfb\u52a0Hubot\u5e94\u7528\uff0c\u5e76\u5c06API\u4ee4\u724c\u63d0\u4f9b\u7ed9Bot\u3002<\/p>\n<p>\u8bf7\u6253\u5f00Slack\u7684Hubot\u9875\u9762\uff0c\u5e76\u8bb0\u4e0bHUBOT_SLACK_TOKEN\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/51-0.png\" alt=\"image.png\" \/><\/div>\n<h2>\u521b\u5efa\u6784\u5efa\u548c\u90e8\u7f72\u811a\u672c<\/h2>\n<p>\u7528\u4e0a\u9762\u521b\u5efa\u7684\u8fd0\u884c\u5668\u542f\u52a8\u7684Docker\u5bb9\u5668\u5e94\u8be5\u4e0e\u8be5\u547d\u4ee4\u5927\u81f4\u76f8\u540c\u3002<br \/>\n\u5728\u6b64\u8fc7\u7a0b\u4e2d\uff0c\u6211\u4eec\u5c06\u5c1d\u8bd5\u6784\u5efa\u548c\u90e8\u7f72\uff0c\u5e76\u521b\u5efa\u811a\u672c\u3002<\/p>\n<pre class=\"post-pre\"><code># docker run --privileged --rm -it \\\r\n   -v \/var\/run\/docker.sock:\/var\/run\/docker.sock \\\r\n   -v \/root\/gitlab-runner\/bin\/docker:\/usr\/local\/bin\/docker \\\r\n   docker \/bin\/bash\r\n<\/code><\/pre>\n<h3>\u6784\u5efa<\/h3>\n<p>\u8fdb\u884c\u5b58\u50a8\u5e93\u7684\u514b\u9686\uff0c\u5e76\u8fdb\u884cDocker\u6784\u5efa\u3002<\/p>\n<pre class=\"post-pre\"><code># cd \u9069\u5f53\u306a\u30d5\u30a9\u30eb\u30c0\r\n# git clone http:\/\/GitLab\u306e\u30ea\u30dd\u30b8\u30c8\u30eaURL\r\n# cd \u30ea\u30dd\u30b8\u30c8\u30ea\u306e\u30d5\u30a9\u30eb\u30c0\r\n# docker build -t homebot .\/\r\n<\/code><\/pre>\n<h3>\u90e8\u7f72<\/h3>\n<p>\u5728\u542f\u52a8\u4e4b\u524d\uff0c\u5148\u505c\u6b62\u548c\u5220\u9664\u65e7\u7248\u7684Redis\u548cHomebot\u5bb9\u5668\u3002<\/p>\n<pre class=\"post-pre\"><code># docker stop \"redis\"    || echo ignore errors.\r\n# docker rm   \"redis\"    || echo ignore errors.\r\n# docker stop \"homebot\"  || echo ignore errors.\r\n# docker rm   \"homebot\"  || echo ignore errors.\r\n# docker run --name redis -d -p 6379:6379 -v \/root\/redis\/data:\/data redis redis-server --appendonly yes\r\n# docker run --name homebot -e REDIS_URL=http:\/\/127.0.0.1:6379\/hubot -e HUBOT_SLACK_TOKEN=YYYYYYYYYYY --net=host -d homebot\r\n<\/code><\/pre>\n<p>\u5728docker stop\u6216docker rm\u65f6\uff0c\u5982\u679c\u6307\u5b9a\u7684\u5bb9\u5668\u4e0d\u5b58\u5728\u4f1a\u5bfc\u81f4\u9519\u8bef\uff0c\u6240\u4ee5\u9700\u8981\u5ffd\u7565\u9519\u8bef\u4ee5\u7ee7\u7eed\u6267\u884c\u6784\u5efa\u811a\u672c\u3002<br \/>\nredis\u5bb9\u5668\u4f7f\u7528\u5b98\u65b9\u955c\u50cf\uff0c\u8fdb\u884c\u7aef\u53e3\u6620\u5c04(-p 6379:6379)\u3001\u6302\u8f7d\u6301\u4e45\u5316\u6570\u636e\u6587\u4ef6\u5939(-v \/root\/redis\/data:\/data)\uff0c\u5e76\u6307\u5b9a\u5199\u5165\u9009\u9879(&#8211;appendonly yes)\u3002<br \/>\nhomebot\u5bb9\u5668\u901a\u8fc7\u73af\u5883\u53d8\u91cf\u6307\u5b9aredis\u7684URL\u548cHUBOT_SLACK_TOKEN\uff0c\u5e76\u4f7f\u7528&#8211;net=host\u9009\u9879\u6307\u5b9a\u4e0e\u4e3b\u673a\u76f8\u540c\u7684\u7f51\u7edc\u3002<br \/>\n&#8211;net=host\u5728\u666e\u901a\u60c5\u51b5\u4e0b\u4e0d\u9700\u8981\u4f7f\u7528\u3002\u56e0\u4e3a\u8fd9\u6b21\u521b\u5efa\u7684\u673a\u5668\u4eba\u9700\u8981\u901a\u8fc7\u811a\u672c\u4f7f\u7528\u7ea2\u5916\u53d1\u9001\u6a21\u5757\uff08RM-Mini3\uff09\uff0c\u6240\u4ee5\u9700\u8981\u5c06\u63a2\u6d4bIP\u8bbe\u7f6e\u4e3a\u4e0e\u5916\u90e8\u7f51\u7edc\u76f8\u540c\uff0c\u5e76\u8fdb\u884c\u4e86\u6307\u5b9a\u3002<\/p>\n<h2>\u5c06.gitlab-ci.yml\u6587\u4ef6\u653e\u7f6e<\/h2>\n<p>\u5c06.gitlab-ci.yml\u6587\u4ef6\u653e\u5728\u4ee3\u7801\u4ed3\u5e93\u7684\u6839\u76ee\u5f55\u3002<br \/>\n\u8fd9\u6837\u4e00\u6765\uff0c\u5f53\u4f7f\u7528git push\u547d\u4ee4\u65f6\uff0cGitLab\u5c06\u81ea\u52a8\u8fd0\u884cCI\u6d41\u7a0b\u3002<\/p>\n<pre class=\"post-pre\"><code>root\r\n\u251c bin\r\n\u251c lib\r\n\u251c scripts\r\n\u251c .gitignore\r\n\u251c .gitlab-ci.yml    &lt;- NEW!!\r\n\u251c .hubot_history\r\n\u251c dockerfile\r\n\u251c external-scripts.json\r\n\u251c package.json\r\n\u251c Procfile\r\n\u2514 README.md\r\n<\/code><\/pre>\n<p>\u5c06\u4e4b\u524d\u6d4b\u8bd5\u8fc7\u7684\u6784\u5efa\u548c\u90e8\u7f72\u811a\u672c\u8bb0\u5f55\u5728.gitlab-ci.yml\u4e2d\u3002<\/p>\n<p>.gitlab-ci.yml \u7684\u7ffb\u8bd1\u4e3a\u4e2d\u6587\u662f\uff1a.gitlab-ci \u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>image: centos\r\n\r\nstages:\r\n  - build\r\n  - deploy\r\n\r\nbuild:\r\n  stage: build\r\n  tags:\r\n    - docker-in-docker\r\n  script:\r\n    - docker build -t homebot .\r\n\r\ndeploy to production:\r\n  stage: deploy\r\n  tags:\r\n    - docker-in-docker\r\n  variables: \r\n    REDIS_URL: redis:\/\/127.0.0.1:6379\/hubot\r\n    HUBOT_SLACK_TOKEN: YYYYYYYYYYYYYYY\r\n  script: \r\n    - docker stop \"redis\"    || echo ignore errors.\r\n    - docker rm   \"redis\"    || echo ignore errors.\r\n    - docker stop \"homebot\"  || echo ignore errors.\r\n    - docker rm   \"homebot\"  || echo ignore errors.\r\n    - docker run --name redis -d -p 6379:6379 -v \/root\/redis\/data:\/data redis redis-server --appendonly yes\r\n    - docker run --name homebot -e REDIS_URL=$REDIS_URL -e HUBOT_SLACK_TOKEN=$HUBOT_SLACK_TOKEN --net=host -d homebot\r\n    - docker rmi `docker images -f \"dangling=true\" -q` || echo ignore errors.\r\n<\/code><\/pre>\n<p>\u5728\u6784\u5efa\u8fc7\u7a0b\u4e2d\u6709\u4e24\u4e2a\u9636\u6bb5\uff0c\u5206\u522b\u662f\u6784\u5efa\uff08build\uff09\u548c\u90e8\u7f72\uff08deploy\uff09\u3002<\/p>\n<p>\u867d\u7136\u4e0e\u4e4b\u524d\u521b\u5efa\u7684\u811a\u672c\u57fa\u672c\u76f8\u540c\uff0c\u4f46\u6211\u5c06REDIS_URL\u548cHUBOT_SLACK_TOKEN\u8fd9\u4e24\u4e2a\u53c2\u6570\u8bbe\u4e3a\u73af\u5883\u53d8\u91cf\u3002\u6b64\u5916\uff0c\u6211\u7ed9docker-in-docker\u6dfb\u52a0\u4e86\u4e00\u4e2a\u6807\u7b7e\uff0c\u4ee5\u4fbf\u5c06\u5176\u5e94\u7528\u5230\u65b0\u521b\u5efa\u7684Runner\u8eab\u4e0a\u3002\u6700\u540e\u7684&#8221;docker rmi \uff5e&#8221;\u662f\u4e3a\u4e86\u907f\u514d\u5728\u4e0d\u505c\u5730\u6784\u5efa\u4e2d\u79ef\u7d2f\u65e0\u540d\u79f0\u7684\u955c\u50cf\uff0c\u6240\u4ee5\u5220\u9664\u4e86\u8fd9\u4e9b\u955c\u50cf\u3002\u5c3d\u7ba1\u6709\u53ef\u80fd\u4f1a\u8bef\u5220\u610f\u5916\u7684\u955c\u50cf\uff0c\u4f46\u8fd9\u4e2a\u65b9\u6cd5\u5e76\u4e0d\u592a\u7406\u60f3\u3002<\/p>\n<h2>\u5c1d\u8bd5\u4e00\u4e0b<\/h2>\n<p>\u5230\u76ee\u524d\u4e3a\u6b62\uff0c\u5e94\u8be5\u5df2\u7ecf\u80fd\u591f\u5c06\u4ee3\u7801\u63a8\u9001\u5230GitLab\u5e76\u542f\u52a8Docker\u5bb9\u5668\u4e86\u3002<\/p>\n<p>\u6240\u4ee5\uff0c\u6211\u6765\u8bd5\u8bd5Push\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/73-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u5728\u6253\u5f00GitLab\u4ed3\u5e93\u7684Pipelines\u65f6\uff0c\u53ef\u4ee5\u770b\u5230\u6b63\u5728\u6784\u5efa\u3002<\/p>\n<h2>\u5c06HUBOT_SLACK_TOKEN\u4ece\u5b58\u50a8\u5e93\u4e2d\u5220\u9664<\/h2>\n<p>\u5982\u679c\u5c06HUBOT_SLACK_TOKEN\u63d0\u4ea4\u5230\u5b58\u50a8\u5e93\u4e2d\u5c31\u65e0\u6cd5\u5220\u9664\u5b83\u3002<br \/>\n\u53ef\u80fd\u60f3\u5f97\u592a\u591a\u4e86\uff0c\u4f46\u662f\u5f53\u672a\u6765\u6709\u66f4\u591a\u5f00\u53d1\u4eba\u5458\u52a0\u5165\u5b58\u50a8\u5e93\u65f6\uff0c<br \/>\n\u4efb\u4f55\u4eba\u90fd\u53ef\u4ee5\u5728Slack\u4e0a\u64cd\u7eb5Bot\u53ef\u80fd\u4e0d\u662f\u597d\u4e8b\u3002<br \/>\nGitLab\u6709\u4e00\u4e2a\u540d\u4e3a\u201cSecret Variables\u201d\u7684\u529f\u80fd\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u7ba1\u7406\u8fd9\u79cd\u975e\u516c\u5f00\u53c2\u6570\uff0c<br \/>\n\u6240\u4ee5\u6211\u4f1a\u5c1d\u8bd5\u4f7f\u7528\u5b83\u3002<\/p>\n<p>\u300cSecret Variables\u300d\u53ef\u4ee5\u5728\u5b58\u50a8\u5e93\u9875\u9762\u2192\u8bbe\u7f6e\u2192CI\/CD\u7ba1\u9053\u4e2d\u627e\u5230\u3002<br \/>\n\u5728\u8fd9\u91cc\u5c06\u5176\u5b9a\u4e49\u4e3aHUBOT_SLACK_TOKEN_PRODUCTION\u3002<br \/>\n\u5728\u6b64\u5b9a\u4e49\u7684\u53d8\u91cf\u53ef\u4ee5\u4f5c\u4e3a\u73af\u5883\u53d8\u91cf\u5728Runner\u4e0a\u4f7f\u7528\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/78-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u6211\u5011\u9700\u8981\u4fee\u6539.gitlab-ci.yml\u6587\u4ef6\uff0c\u4ee5\u4f7f\u7528\u9019\u500b\u74b0\u5883\u8b8a\u6578\u3002<\/p>\n<p>.gitlab-ci.yml can be paraphrased in Chinese as &#8220;.gitlab-ci.yml&#8221;.<\/p>\n<pre class=\"post-pre\"><code>image: centos\r\n\r\nstages:\r\n  - build\r\n  - deploy\r\n\r\nbuild:\r\n  stage: build\r\n  tags:\r\n    - docker-in-docker\r\n  script:\r\n    - docker build -t homebot .\r\n\r\ndeploy to production:\r\n  stage: deploy\r\n  tags:\r\n    - docker-in-docker\r\n  variables: \r\n    REDIS_URL: redis:\/\/127.0.0.1:6379\/hubot\r\n    HUBOT_SLACK_TOKEN: $HUBOT_SLACK_TOKEN_PRODUCTION          #Changed!\r\n  script: \r\n    - docker stop \"redis\"    || echo ignore errors.\r\n    - docker rm   \"redis\"    || echo ignore errors.\r\n    - docker stop \"homebot\"  || echo ignore errors.\r\n    - docker rm   \"homebot\"  || echo ignore errors.\r\n    - docker run --name redis -d -p 6379:6379 -v \/root\/redis\/data:\/data redis redis-server --appendonly yes\r\n    - docker run --name homebot -e REDIS_URL=$REDIS_URL -e HUBOT_SLACK_TOKEN=$HUBOT_SLACK_TOKEN --net=host -d homebot\r\n    - docker rmi `docker images -f \"dangling=true\" -q` || echo ignore errors.\r\n<\/code><\/pre>\n<h2>\u5c06\u751f\u4ea7\u670d\u52a1\u5668\u548c\u6f14\u793a\u670d\u52a1\u5668\u5206\u5f00\u3002<\/h2>\n<p>\u73b0\u5728\uff0c\u5df2\u7ecf\u53ef\u4ee5\u5c06\u4ee3\u7801\u63a8\u9001\u5230GitLab\u5e76\u8fdb\u884c\u90e8\u7f72\u4e86\uff0c\u4f46\u662f\u53ea\u901a\u8fc7\u63a8\u9001\u5c31\u76f4\u63a5\u90e8\u7f72\u5230\u751f\u4ea7\u670d\u52a1\u5668\uff0c\u611f\u89c9\u6709\u70b9\u53ef\u6015\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u6545\u969c\u3002\u5982\u679c\u9996\u5148\u90e8\u7f72\u5230\u6682\u5b58\u670d\u52a1\u5668\u5e76\u786e\u8ba4\u5176\u6b63\u5e38\u8fd0\u884c\uff0c\u7136\u540e\u518d\u90e8\u7f72\u5230\u751f\u4ea7\u670d\u52a1\u5668\uff0c\u5fc3\u91cc\u5c31\u8212\u7545\u591a\u4e86\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/84-0.png\" alt=\"\u56f37.png\" \/><\/div>\n<p>\u65e2\u7136\u6b63\u5728\u4f7f\u7528Docker\uff0c\u6211\u60f3\u7b80\u5355\u5730\u589e\u52a0\u8fd9\u4e9b\u5b9e\u4f8b\u7684\u6570\u91cf\u3002<\/p>\n<p>\u65b9\u6cd5\u4e0a\uff0c\u53ef\u4ee5\u7a0d\u5fae\u53c2\u8003GitLab Flow\uff0c\u6309\u7167\u4ee5\u4e0b\u65b9\u5f0f\u8fdb\u884c\uff1a<br \/>\n* \u63d0\u4ea4\u5230\u4e3b\u5206\u652f \u2192 \u90e8\u7f72\u5230Staging\u73af\u5883<br \/>\n* \u63d0\u4ea4\u5230\u751f\u4ea7\u5206\u652f \u2192 \u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883<\/p>\n<p>\u987a\u4fbf\u63d0\u4e00\u4e0b\uff0cGitLab\u4e0a\u6709\u4e00\u4e2a\u540d\u4e3a&#8221;Manual actions&#8221;\u7684\u529f\u80fd\uff0c\u636e\u8bf4\u53ef\u4ee5\u901a\u8fc7\u5728GitLab\u7684Pipeline\u4e0a\u70b9\u51fb\u6309\u94ae\u8fdb\u884c\u90e8\u7f72\u3002<br \/>\n\u542c\u8d77\u6765\u5f88\u6709\u8da3\uff0c\u4f46\u662f\u7531\u4e8e\u4f1a\u4f9d\u8d56\u7279\u5b9a\u7684CI\u529f\u80fd\uff0c\u4f1a\u964d\u4f4e\u79fb\u690d\u6027\uff0c\u6240\u4ee5\u6211\u4eec\u901a\u8fc7git\u7684\u5206\u652f\u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u4e3a\u4e86\u589e\u52a0 Stage \u73af\u5883\u7684\u90e8\u7f72\uff0c\u9700\u8981\u4fee\u6539 .gitlab-ci.yml \u6587\u4ef6\u3002<\/p>\n<p>.gitlab-ci.yml\u7684\u610f\u601d\u662fGitLab\u6301\u7eed\u96c6\u6210\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n<pre class=\"post-pre\"><code>image: centos\r\n\r\nstages:\r\n  - build\r\n  - deploy\r\n\r\nbuild:\r\n  stage: build\r\n  script:\r\n    - docker build -t homebot .\r\n  tags:\r\n    - docker-in-docker\r\n\r\ndeploy to staging:\r\n  stage: deploy\r\n  variables: \r\n    REDIS_URL: redis:\/\/127.0.0.1:16379\/hubot\r\n    HUBOT_SLACK_TOKEN: $HUBOT_SLACK_TOKEN_STAGING\r\n  script:\r\n    - docker stop \"redis-staging\"    || echo ignore errors.\r\n    - docker rm   \"redis-staging\"    || echo ignore errors.\r\n    - docker stop \"homebot-staging\"  || echo ignore errors.\r\n    - docker rm   \"homebot-staging\"  || echo ignore errors.\r\n    - docker run --name redis-staging -d -p 16379:6379 -v \/root\/redis-staging\/data:\/data redis redis-server --appendonly yes\r\n    - docker run --name homebot-staging -e REDIS_URL=$REDIS_URL -e HUBOT_SLACK_TOKEN=$HUBOT_SLACK_TOKEN --net=host -d homebot\r\n    - docker rmi `docker images -f \"dangling=true\" -q` || echo ignore errors.\r\n  only:\r\n    - master\r\n  tags:\r\n    - docker-in-docker\r\n\r\ndeploy to production:\r\n  stage: deploy\r\n  variables: \r\n    REDIS_URL: redis:\/\/127.0.0.1:6379\/hubot\r\n    HUBOT_SLACK_TOKEN: $HUBOT_SLACK_TOKEN_PRODUCTION\r\n  script: \r\n    - docker stop \"redis\"    || echo ignore errors.\r\n    - docker rm   \"redis\"    || echo ignore errors.\r\n    - docker stop \"homebot\"  || echo ignore errors.\r\n    - docker rm   \"homebot\"  || echo ignore errors.\r\n    - docker run --name redis -d -p 6379:6379 -v \/root\/redis\/data:\/data redis redis-server --appendonly yes\r\n    - docker run --name homebot -e REDIS_URL=$REDIS_URL -e HUBOT_SLACK_TOKEN=$HUBOT_SLACK_TOKEN --net=host -d homebot\r\n    - docker rmi `docker images -f \"dangling=true\" -q` || echo ignore errors.\r\n  only:\r\n    - production\r\n  tags:\r\n    - docker-in-docker\r\n<\/code><\/pre>\n<p>\u5909\u308f\u3063\u305f\u70b9\u306f\u3001 deploy\u30b9\u30c6\u30fc\u30b8\u3068\u3057\u3066\u3001\u300cdeploy to staging\u300d\u3092\u5897\u3084\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<br \/>\n* \u30b3\u30f3\u30c6\u30ca\u540d\u3092\u300credis-staging\u300d\u300chomebot-staging\u300d\u3068\u672c\u756a\u3068\u306f\u5225\u306e\u540d\u524d\u306b\u3059\u308b<br \/>\n* Radis\u306e\u30dd\u30fc\u30c8\u309216379\u306b\u3059\u308b<br \/>\n* Radis\u306e\u6c38\u7d9a\u5316\u5148\u3092\u672c\u756a\u3068\u306f\u5225\u306b\u3059\u308b<br \/>\n* Slack\u306bHubot\u306e\u8a2d\u5b9a\u3092\u3082\u30461\u3064\u4f5c\u3063\u3066\u3001\u4e0a\u3067\u8aac\u660e\u3057\u305f\u300cSecret Variables\u300d\u306b\u300cHUBOT_SLACK_TOKEN_STAGING\u300d\u3068\u3057\u3066\u30c8\u30fc\u30af\u30f3\u3092\u8a2d\u5b9a\u3057\u3066\u304a\u304d\u307e\u3059\u3002HUBOT_SLACK_TOKEN\u306b\u306f\u305d\u306e\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305f\u3001\u300cdeploy to staging\u300d\u306fmaster\u30d6\u30e9\u30f3\u30c1\u3067\u306e\u307f\u3001\u300cdeploy to production\u300d\u306fproduction\u30d6\u30e9\u30f3\u30c1\u3067\u306e\u307f\u3001\u30d3\u30eb\u30c9\u3055\u308c\u308b\u3088\u3046\u306b\u300conly\u300d\u3092\u8a2d\u5b9a\u3057\u3066\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<h2>\u6211\u8bd5\u7740\u6309\u4e0b\u53bb<\/h2>\n<p>\u5f53\u5c06\u4ee3\u7801\u63a8\u9001\u5230\u4e3b\u5206\u652f\uff08master branch\uff09\u65f6\uff0c\u53ef\u4ee5\u53d1\u73b0\u4f1a\u8fd0\u884c\u90e8\u7f72\u5230\u6682\u5b58\u73af\u5883\uff08staging\uff09\u7684\u6784\u5efa\uff1b\u5f53\u5c06\u4ee3\u7801\u63a8\u9001\u5230\u751f\u4ea7\u5206\u652f\uff08production branch\uff09\u65f6\uff0c\u53ef\u4ee5\u53d1\u73b0\u4f1a\u8fd0\u884c\u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883\u7684\u6784\u5efa\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/95-0.png\" alt=\"image.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/96-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u67e5\u770bDocker\u5bb9\u5668\u65f6\uff0c\u53d1\u73b0\u6bcf\u4e2a\u6709homebot\u548chomebot-staging\u3001radis\u548cradis-staging\u4e24\u4e2a\u5b9e\u4f8b\u3002<\/p>\n<pre class=\"post-pre\"><code># docker ps -a\r\nCONTAINER ID        IMAGE                  COMMAND                  CREATED             STATUS                     PORTS                     NAMES\r\ncbb3f1c3f3cd        homebot                \"\/bin\/sh -c 'sh \/app\u2026\"   4 minutes ago       Up 4 minutes                                         homebot-staging\r\ndeb43da1e0bc        redis                  \"docker-entrypoint.s\u2026\"   4 minutes ago       Up 4 minutes               0.0.0.0:16379-&gt;6379\/tcp   redis-staging\r\nbc126c964ccc        homebot                \"\/bin\/sh -c 'sh \/app\u2026\"   4 minutes ago       Up 4 minutes                                         homebot\r\n51eea4d849c9        redis                  \"docker-entrypoint.s\u2026\"   4 minutes ago       Up 4 minutes               0.0.0.0:6379-&gt;6379\/tcp    redis\r\n897153d3393f        aea904bf7887           \"gitlab-runner-cache\u2026\"   5 minutes ago       Exited (0) 5 minutes ago                             runner-ccce4edb-project-22-concurrent-0-cache-3c3f060a0374fc8bc39395164f415a70\r\nb6b8ff1edcf9        aea904bf7887           \"gitlab-runner-cache\u2026\"   5 minutes ago       Exited (0) 5 minutes ago                             runner-ccce4edb-project-22-concurrent-0-cache-0a45d2bc3900e132e076ffa38608b42a\r\n2a32bac99e7a        gitlab\/gitlab-runner   \"\/usr\/bin\/dumb-init \u2026\"   4 days ago          Up 5 minutes                                         gitlab-runner-docker\r\n<\/code><\/pre>\n<p>\u5728Slack\u4e0a\u7684Hubot\u4e5f\u80fd\u6b63\u786e\u5730\u54cd\u5e94\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/100-0.png\" alt=\"image.png\" \/><\/div>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/101-0.png\" alt=\"image.png\" \/><\/div>\n<h2>\u5c1d\u8bd5\u4f7f\u7528GitLab Environments<\/h2>\n<p>\u6839\u636e\u6211\u7684\u7406\u89e3\uff0cGitLab\u6709\u4e00\u4e2a\u540d\u4e3a\u201c\u73af\u5883\uff08Environments\uff09\u201d\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u6ce8\u518c\u90e8\u7f72\u76ee\u6807\u3002<br \/>\n\u65e2\u7136\u6709\u8fd9\u4e2a\u529f\u80fd\uff0c\u6211\u60f3\u5c1d\u8bd5\u4e00\u4e0b\u3002<\/p>\n<p>\u6211\u4f1a\u5728.gitlab-ci.yml\u4e2d\u6dfb\u52a0\u73af\u5883\u53d8\u91cf\u3002<br \/>\n\u5982\u679c\u5199\u4e0aURL\uff0c\u5b83\u5c06\u94fe\u63a5\u5230GitLab\u4e0a\u3002<br \/>\n\u7531\u4e8e\u8fd9\u6b21Hubot\u672c\u8eab\u6ca1\u6709\u524d\u7aef\uff0c\u6211\u5c06\u6307\u5b9a\u5230Slack\u4e0a\u7684Hubot\u76f4\u63a5\u6d88\u606f\u9875\u9762\u3002<\/p>\n<p>.gitlab-ci.yml<\/p>\n<pre class=\"post-pre\"><code>image: centos\r\n\r\nstages:\r\n  - build\r\n  - deploy\r\n\r\nbuild:\r\n  stage: build\r\n  script:\r\n    - docker build -t homebot .\r\n  tags:\r\n    - docker-in-docker\r\n\r\ndeploy to staging:\r\n  stage: deploy\r\n  variables: \r\n    REDIS_URL: redis:\/\/127.0.0.1:16379\/hubot\r\n    HUBOT_SLACK_TOKEN: $HUBOT_SLACK_TOKEN_STAGING\r\n  script:\r\n    - docker stop \"redis-staging\"    || echo ignore errors.\r\n    - docker rm   \"redis-staging\"    || echo ignore errors.\r\n    - docker stop \"homebot-staging\"  || echo ignore errors.\r\n    - docker rm   \"homebot-staging\"  || echo ignore errors.\r\n    - docker run --name redis-staging -d -p 16379:6379 -v \/root\/redis-staging\/data:\/data redis redis-server --appendonly yes\r\n    - docker run --name homebot-staging -e REDIS_URL=$REDIS_URL -e HUBOT_SLACK_TOKEN=$HUBOT_SLACK_TOKEN --net=host -d homebot\r\n    - docker rmi `docker images -f \"dangling=true\" -q` || echo ignore errors.\r\n  only:\r\n    - master\r\n  environment:\r\n    name: review\r\n    url: https:\/\/banban55remocon.slack.com\/messages\/D9S1U9C7P\/\r\n  tags:\r\n    - docker-in-docker\r\n\r\ndeploy to production:\r\n  stage: deploy\r\n  variables: \r\n    REDIS_URL: redis:\/\/127.0.0.1:6379\/hubot\r\n    HUBOT_SLACK_TOKEN: $HUBOT_SLACK_TOKEN_PRODUCTION\r\n  script: \r\n    - docker stop \"redis\"    || echo ignore errors.\r\n    - docker rm   \"redis\"    || echo ignore errors.\r\n    - docker stop \"homebot\"  || echo ignore errors.\r\n    - docker rm   \"homebot\"  || echo ignore errors.\r\n    - docker run --name redis -d -p 6379:6379 -v \/root\/redis\/data:\/data redis redis-server --appendonly yes\r\n    - docker run --name homebot -e REDIS_URL=$REDIS_URL -e HUBOT_SLACK_TOKEN=$HUBOT_SLACK_TOKEN --net=host -d homebot\r\n    - docker rmi `docker images -f \"dangling=true\" -q` || echo ignore errors.\r\n  only:\r\n    - production\r\n  environment:\r\n    name: production\r\n    url: https:\/\/banban55remocon.slack.com\/messages\/D9K4Z5AKB\/\r\n  tags:\r\n    - docker-in-docker\r\n<\/code><\/pre>\n<p>\u5f53\u5728 Git Push \u5e76\u6784\u5efa\u4e4b\u540e\uff0c\u5728 GitLab \u4ed3\u5e93\u7684 Environment \u4e2d\uff0c\u4f1a\u4ee5\u4ee5\u4e0b\u65b9\u5f0f\u5c55\u793a\uff0c\u5373\u5448\u73b0\u4e24\u4e2a\u73af\u5883\u3002<\/p>\n<div><img decoding=\"async\" class=\"post-images\" title=\"\" src=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/108-0.png\" alt=\"image.png\" \/><\/div>\n<p>\u901a\u8fc7\u70b9\u51fb&#8221;\u91cd\u65b0\u90e8\u7f72&#8221;\u6309\u94ae\u6765\u89e6\u53d1\u91cd\u65b0\u6784\u5efa\uff0c\u800c\u70b9\u51fb\u65c1\u8fb9\u7684\u94fe\u63a5\u6309\u94ae\u53ef\u4ee5\u6253\u5f00Slack\u9875\u9762\u3002<\/p>\n<h2>\u603b\u7ed3<\/h2>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitLab-CI\u3092\u4f7f\u3063\u3066\u3001Git Push\u3059\u308b\u3068Bot\u3092\u30c7\u30d7\u30ed\u30a4\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\n<li style=\"list-style-type: none;\">\n<ul class=\"post-ul\">GitLab-Runner\u3084Bot\u306fDocker\u4e0a\u3067\u52d5\u4f5c\u3057\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u6570\u3092\u5909\u3048\u3089\u308c\u307e\u3059<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul class=\"post-ul\">\u2191\u3092\u5229\u7528\u3057\u3066\u3001\u672c\u756a\u30b5\u30fc\u30d0\u2015\u3068\u30b9\u30c6\u30fc\u30b8\u30f3\u30b0\u30b5\u30fc\u30d0\u30fc\u306e2\u3064\u3092\u7c21\u5358\u306b\u7acb\u3066\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3057\u305f<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6709\u4e00\u4e2a\u540d\u4e3aHubot\u7684\u804a\u5929\u673a\u5668\u4eba\u5f00\u53d1\u548c\u6267\u884c\u6846\u67b6\u3002 \u5b83\u5728Node.js\u4e0a\u8fd0\u884c\uff0c\u6240\u4ee5\u53ea\u8981\u5c06\u5176\u90e8\u7f72\u5230Heroku\u6216\u9002 [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-33970","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot - Blog - Silicon Cloud<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528gitlab-ci\uff0c\u5728docker\u4e0a\u90e8\u7f72hubot\u5236\u4f5c\u7684bot\u3002\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot\" \/>\n<meta property=\"og:description\" content=\"\u6709\u4e00\u4e2a\u540d\u4e3aHubot\u7684\u804a\u5929\u673a\u5668\u4eba\u5f00\u53d1\u548c\u6267\u884c\u6846\u67b6\u3002 \u5b83\u5728Node.js\u4e0a\u8fd0\u884c\uff0c\u6240\u4ee5\u53ea\u8981\u5c06\u5176\u90e8\u7f72\u5230Heroku\u6216\u9002 [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528gitlab-ci\uff0c\u5728docker\u4e0a\u90e8\u7f72hubot\u5236\u4f5c\u7684bot\u3002\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-06-30T10:07:19+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-05-04T02:29:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/2-0.png\" \/>\n<meta name=\"author\" content=\"\u79d1, \u96c5\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u79d1, \u96c5\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/\",\"name\":\"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-06-30T10:07:19+00:00\",\"dateModified\":\"2024-05-04T02:29:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a\",\"name\":\"\u79d1, \u96c5\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g\",\"caption\":\"\u79d1, \u96c5\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot - Blog - Silicon Cloud","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528gitlab-ci\uff0c\u5728docker\u4e0a\u90e8\u7f72hubot\u5236\u4f5c\u7684bot\u3002\/","og_locale":"zh_CN","og_type":"article","og_title":"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot","og_description":"\u6709\u4e00\u4e2a\u540d\u4e3aHubot\u7684\u804a\u5929\u673a\u5668\u4eba\u5f00\u53d1\u548c\u6267\u884c\u6846\u67b6\u3002 \u5b83\u5728Node.js\u4e0a\u8fd0\u884c\uff0c\u6240\u4ee5\u53ea\u8981\u5c06\u5176\u90e8\u7f72\u5230Heroku\u6216\u9002 [&hellip;]","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u4f7f\u7528gitlab-ci\uff0c\u5728docker\u4e0a\u90e8\u7f72hubot\u5236\u4f5c\u7684bot\u3002\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-06-30T10:07:19+00:00","article_modified_time":"2024-05-04T02:29:37+00:00","og_image":[{"url":"https:\/\/cdn.silicloud.com\/blog-img\/blog\/img\/657d1add37434c4406c0cc6c\/2-0.png"}],"author":"\u79d1, \u96c5","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u79d1, \u96c5","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"8 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/","name":"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-06-30T10:07:19+00:00","dateModified":"2024-05-04T02:29:37+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a"},"breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u4f7f\u7528GitLab-CI\uff0c\u5728Docker\u4e0a\u90e8\u7f72Hubot\u5236\u4f5c\u7684Bot"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/41e222757cdd2a3365361328bd79970a","name":"\u79d1, \u96c5","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1b2d3e00a7df03689797ebd4af8c5827ba5af936849a71050ec331f4cf902c5d?s=96&d=mm&r=g","caption":"\u79d1, \u96c5"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/keya\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e4%bd%bf%e7%94%a8gitlab-ci%ef%bc%8c%e5%9c%a8docker%e4%b8%8a%e9%83%a8%e7%bd%b2hubot%e5%88%b6%e4%bd%9c%e7%9a%84bot%e3%80%82\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/33970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=33970"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/33970\/revisions"}],"predecessor-version":[{"id":97784,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/33970\/revisions\/97784"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=33970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=33970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=33970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}