{"id":22813089,"url":"https://github.com/coderivan/aliyun-docker-trigger","last_synced_at":"2026-05-08T03:48:11.235Z","repository":{"id":42257808,"uuid":"196312495","full_name":"CoderIvan/aliyun-docker-trigger","owner":"CoderIvan","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-05T09:35:12.000Z","size":939,"stargazers_count":2,"open_issues_count":14,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-21T02:01:59.248Z","etag":null,"topics":["aliyun","cd","ci","docker","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CoderIvan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-11T03:20:50.000Z","updated_at":"2024-11-20T07:00:12.000Z","dependencies_parsed_at":"2025-10-13T07:02:39.164Z","dependency_job_id":"ff2a9207-63fe-49ec-a143-f1315d64d8ad","html_url":"https://github.com/CoderIvan/aliyun-docker-trigger","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/CoderIvan/aliyun-docker-trigger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderIvan%2Faliyun-docker-trigger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderIvan%2Faliyun-docker-trigger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderIvan%2Faliyun-docker-trigger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderIvan%2Faliyun-docker-trigger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CoderIvan","download_url":"https://codeload.github.com/CoderIvan/aliyun-docker-trigger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CoderIvan%2Faliyun-docker-trigger/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32766122,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun","cd","ci","docker","nodejs"],"created_at":"2024-12-12T12:15:02.566Z","updated_at":"2026-05-08T03:48:11.201Z","avatar_url":"https://github.com/CoderIvan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 阿里云容器服务触发器\n\n![Node.js CI](https://github.com/CoderIvan/aliyun-docker-trigger/workflows/Node.js%20CI/badge.svg)\n\n## 需要\n\n1. ubuntu\n1. docker\n\n## 部署服务\n\n1. clone该仓库，创建镜像\n1. 使用Docker部署该镜像\n  ![image](https://user-images.githubusercontent.com/7960859/70210213-16d2a880-176d-11ea-8b6c-7e586d60d832.png)\n  1. 挂载`/var/run/docker.sock`至容器中的`/var/run/docker.sock`，使用容器中的Docker可以控制宿主机的Docker\n  1. 挂载`~/.docker/config.json`至容器中的`/root/.docker/config.json`，使用容器拥有pull阿里镜像的权限\n  1. 挂载`./dockerfiles`至容器中的`/app/dockerfiles`，告诉容器中的服务该维护哪些容器\n\n## 环境变量配置\n![image](https://user-images.githubusercontent.com/7960859/86327006-1ce22680-bc75-11ea-83da-a785fcfa48e2.png)\n\nEMAIL_TRANSPORT_USER: 发送邮件的邮箱名\nEMAIL_TRANSPORT_PASS: 发送邮件的邮箱密码\nEMAIL_SUBSCRIBERS: 默认订阅者(多个时，以`,`分隔)\n\n## 配置阿里云的触发器\n\n#### 让镜像随代码变更自动构建\n  ![image](https://user-images.githubusercontent.com/7960859/70210507-d3c50500-176d-11ea-9392-de10a4302d6b.png)\n  1. 当对应分支有代码提交后会自动触发构建\n  1. 以上图为例，`branch`:`mqtt-broker`为测试网版本的分支，每次提交代码会自动触发构建，并创建`test`版本的镜像\n\n#### 为镜像添加触发器\n  ![image](https://user-images.githubusercontent.com/7960859/70210781-8dbc7100-176e-11ea-8864-7c2c27d656ff.png)\n  ![image](https://user-images.githubusercontent.com/7960859/70210749-72516600-176e-11ea-9a2b-f3643122432f.png)\n  1. 配置触发器URL，这是测试网暴露的`aliyun-docker-trigger`服务\n  1. 触发方式选择`Tag触发`，Tag选择你的部署的镜像版本，以上一点`自动构建`为例，镜像版本为`test`，随着上面每完成一次`test`版本镜像的`build`完成而触发\n\n## 配置aliyun-docker-trigger的触发器\n\n#### 配置dockerfiles文件夹\n  ![image](https://user-images.githubusercontent.com/7960859/70211372-dd4f6c80-176f-11ea-933a-1b409a2ef312.png)\n  1. 在dockerfiles下创建层级文件夹\n  1. 文件夹名对应为`镜像名`和`TAG名`，例如参考上面的步骤，我需要创建mqtt-broker/test\n  1. 在上一步的文件夹下创建docker-compose.ymal文件\n\n#### 配置Email接受部署成功的邮件提示\n  ![image](https://user-images.githubusercontent.com/7960859/70211923-45eb1900-1771-11ea-8fc0-a5840f2cf69d.png)\n  ![image](https://user-images.githubusercontent.com/7960859/70211959-60bd8d80-1771-11ea-8dab-568bb6046487.png)\n\n## 触发原理\n1. aliyun触发器触发后，会给指定的地址（以上为例：`http://www.dbjtech.com:8000/`）发送请求，并携带`镜像名`(以上为例：mqtt-broker)与`Tag名`(以上为例：test)\n1. aliyun-docker-trigger服务，`镜像名`(以上为例：mqtt-broker)与`Tag名`(以上为例：test)，找`dockerfiles`是否有该文件目录(以上为例：找`mqtt-broker/test`文件夹是否存在)\n1. 如果存在，则获取`docker-compose.yml`文件\n1. 执行`docker pull registry.cn-qingdao.aliyuncs.com/dbjtech/${name}:${tag}`\n1. 执行`docker stack deploy -c ${file} ${name} ${tag} --with-registry-auth`\n1. 检查`email.js`是否存在，存在则发送邮件","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderivan%2Faliyun-docker-trigger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderivan%2Faliyun-docker-trigger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderivan%2Faliyun-docker-trigger/lists"}