{"id":19057441,"url":"https://github.com/femessage/dockerize-cli","last_synced_at":"2025-04-24T05:21:53.560Z","repository":{"id":100171572,"uuid":"288928441","full_name":"FEMessage/dockerize-cli","owner":"FEMessage","description":"🐳  Dockerize your web project in one minute","archived":false,"fork":false,"pushed_at":"2020-08-27T03:29:54.000Z","size":1663,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"dev","last_synced_at":"2025-04-21T14:35:03.453Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FEMessage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2020-08-20T06:45:15.000Z","updated_at":"2021-10-13T07:05:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"8f628b97-b6d4-43c0-a861-a73496bc1b51","html_url":"https://github.com/FEMessage/dockerize-cli","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fdockerize-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fdockerize-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fdockerize-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FEMessage%2Fdockerize-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FEMessage","download_url":"https://codeload.github.com/FEMessage/dockerize-cli/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250567889,"owners_count":21451517,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-11-08T23:57:22.179Z","updated_at":"2025-04-24T05:21:53.551Z","avatar_url":"https://github.com/FEMessage.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🐳 dockerize-cli\n\n[![NPM Download](https://badgen.net/npm/dm/@femessage/dockerize-cli)](https://www.npmjs.com/package/@femessage/dockerize-cli)\n[![NPM Version](https://badgen.net/npm/v/@femessage/dockerize-cli)](https://www.npmjs.com/package/@femessage/dockerize-cli)\n[![NPM License](https://badgen.net/npm/license/dockerize-cli)](https://github.com/femessage/dockerize-cli/blob/master/LICENSE)\n[![PRs Welcome](https://badgen.net/badge/PRs/welcome/green)](https://github.com/femessage/dockerize-cli/pulls)\n\n🔨 前端项目 docker 化利器，帮助你快速的把前端项目打造通过环境变量启动的镜像。\n\n## 目录\n\n- [注意事项](#注意事项)\n  - [环境需求](#环境需求)\n- [使用教程](#使用教程)\n  - [快速开始](#快速开始)\n  - [参数选项](#参数选项)\n- [Links](#links)\n\n## 注意事项\n\n### 环境需求\n\nNode.js 8.x\n\n### replace 问题\n\nreplace 是通过下载代码中的 url 连接到本地，然后替换这个 url 为本地文件引用来完成替换的。\n\n下载默认会使用 https 协议，如果下载源的 https 证书过期的话，node 会在 SSL 检查的时候帮我们把链接断开。\n\n此时需要在项目根目录增加 dockerize.config.js 配置文件\n\n例子\n\n```js\nmodule.exports = {\n  linkesFilter(links, ignores) {\n    const ignoreArray = ignores.concat([/https?:\\/\\/img.t.sinajs.cn/])\n\n    return [...new Set(links)].filter((link) =\u003e {\n      return !ignoreArray.some((regexp) =\u003e regexp.test(link))\n    })\n  },\n  rejectUnauthorized: false, // 容许 https 证书无效\n}\n```\n\n## 使用教程\n\n### 快速开始\n\n```shell\n# 在项目根目录执行\n\n# 如果本来项目已经包含了 init 的文件，请参照自己需求修改或者删除自己原本的文件改造\n\nnpx @femessage/dockerize-cli init\n```\n\n### 参数选项\n\n`npx @femessage/dockerize-cli replace [dist][public_path]`\n\n1. dist 为目录名\n2. public_path 为上下文地址，默认不填写是 /\n\n把对应的前端构建产物里面的所有网络链接下载到本地，然后替换掉原本的网络链接，使其变成本地静态资源。\n\nps: 一般私有化部署前端项目，客户环境又不能访问外网的时候有用。\n\n![replace](./public/images/replace.gif)\n\n[⬆ Back to Top](#目录)\n\n```shell\nnpx @femessage/dockerize-cli proxy\n```\n\n启动一个静态资源服务器，并且对对应接口提供代理服务，以解决跨域测试 dist 文件的问题\n\n需要配合项目根目录的 dockerize.config.js 启动\n\n在你的根目录创建 dockerize.config.js 文件。\n\n```js\nconst API_SERVER = 'http:/www.deepexi.api/'\n\nmodule.exports = {\n  // 需要代理的接口\n  proxy: {\n    '/api': {\n      target: API_SERVER,\n      changeOrigin: true,\n    },\n    '/asset-service': API_SERVER,\n    '/identity-service': API_SERVER,\n    '/openapi': API_SERVER,\n    '/cooperation-service': API_SERVER,\n  },\n  // 静态资源目录\n  staticPath: 'dist',\n  // 静态资源服务器的端口号\n  proxyPort: 9000,\n}\n```\n\n[⬆ Back to Top](#目录)\n\n```shell\nnpx @femessage/dockerize-cli init\n```\n\n快速添加 docker 所需相关文件，以及 npm script 到你的项目中\n\n![init](./public/images/init.gif)\n\n具体文件以及 npm script 使用方法可以查看 init 之后，在项目根目录生成的 DOCKER_BUILD.md\n\n[⬆ Back to Top](#目录)\n\n## Links\n- [设计文档](https://www.yuque.com/ubdme4/ccc/mto2nz#BAbmJ)\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore --\u003e\n\u003ctable\u003e\u003ctr\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://www.ccc1996.cn\"\u003e\u003cimg src=\"https://avatars1.githubusercontent.com/u/20502762?v=4\" width=\"100px;\" alt=\"cjf\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ecjf\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/dockerize-cli/commits?author=cjfff\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/FEMessage/dockerize-cli/commits?author=cjfff\" title=\"Tests\"\u003e⚠️\u003c/a\u003e \u003ca href=\"#blog-cjfff\" title=\"Blogposts\"\u003e📝\u003c/a\u003e \u003ca href=\"#maintenance-cjfff\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"http://dream2023.github.io\"\u003e\u003cimg src=\"https://avatars0.githubusercontent.com/u/19297757?v=4\" width=\"100px;\" alt=\"超杰\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003e超杰\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/dockerize-cli/commits?author=dream2023\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003ctd align=\"center\"\u003e\u003ca href=\"https://blog.deepenlau.me/\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/14030995?v=4\" width=\"100px;\" alt=\"deepen\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003edeepen\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/FEMessage/dockerize-cli/commits?author=DeepenLau\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemessage%2Fdockerize-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffemessage%2Fdockerize-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffemessage%2Fdockerize-cli/lists"}