Docker 搭建本地 cnpm 私有仓库

Posted winyh

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Docker 搭建本地 cnpm 私有仓库相关的知识,希望对你有一定的参考价值。

1.首先启动本地的docker

2.下载 cnpm 仓库

git clone https://github.com/cnpm/cnpmjs.org.git

  

3.进入到 cnpmjs.org目录

cd  cnpmjs.org

  

4.通过docker-compose.yaml启动容器

docker-compose up

  

5.浏览器访问:127.0.0.1:7002 即可访问(127.0.0.1:7001 是registery 注册地址)

技术图片

5.仓库部署成功后访问和使用
cnpm config get registry  // 查看注册地址是否是 http://127.0.0.1:7001/

  

6.修改cnpm注册地址

 cnpm config set registry http://127.0.0.1:7001

  

7.本地 cnpm 注册

cnpm login // 根据提示输入

Username: winyh
Password: 
Email: (this IS public) 1******8@qq.com
Logged in as winyh on http://127.0.0.1:7001/.

  

看到 Logged in as winyh on http://127.0.0.1:7001/. 证明在本地私有仓库注册成功了。

8.发布包到 私有仓库

cnpm publish

  

终端日志:

npm notice 
npm notice ??  @cnpm/winyh-vue@0.0.1
npm notice === Tarball Contents === 
npm notice 176B    dist/demo.html                 
npm notice 200B    lib/demo.html                  
npm notice 561B    public/index.html              
npm notice 4.3kB   public/favicon.ico             
npm notice 196B    babel.config.js                
npm notice 139B    packages/button/index.js       
npm notice 124B    packages/col/index.js          
npm notice 699B    packages/index.js              
npm notice 129B    packages/list/index.js         
npm notice 174B    packages/row/index.js          
npm notice 134B    packages/table/index.js        
npm notice 418B    src/main.js                    
npm notice 112.3kB lib/winyh-vue.common.js     
npm notice 112.7kB lib/winyh-vue.umd.js        
npm notice 36.4kB  lib/winyh-vue.umd.min.js    
npm notice 87.9kB  dist/winyh.common.js          
npm notice 88.3kB  dist/winyh.umd.js             
npm notice 27.1kB  dist/winyh.umd.min.js         
npm notice 146B    vue.config.js                  
npm notice 1.4kB   package.json                   
npm notice 143.1kB lib/winyh-vue.common.js.map 
npm notice 143.6kB lib/winyh-vue.umd.js.map    
npm notice 166.7kB lib/winyh-vue.umd.min.js.map
npm notice 108.1kB dist/winyh.common.js.map      
npm notice 108.7kB dist/winyh.umd.js.map         
npm notice 128.4kB dist/winyh.umd.min.js.map     
npm notice 587B    README.md                      
npm notice 6.8kB   src/assets/logo.png            
npm notice 686B    src/App.vue                    
npm notice 2.0kB   src/components/HelloWorld.vue  
npm notice 3.1kB   packages/button/src/main.vue   
npm notice 4.6kB   packages/col/src/main.vue      
npm notice 186B    packages/list/src/main.vue     
npm notice 2.8kB   packages/row/src/main.vue      
npm notice 3.2kB   packages/table/src/main.vue    
npm notice === Tarball Details === 
npm notice name:          @cnpm/winyh-vue                      
npm notice version:       0.0.1                                   
npm notice package size:  287.3 kB                                
npm notice unpacked size: 1.3 MB                                  
npm notice shasum:        0975fe7f3015fbdaf52c2d92aa45c2e7b6873f08
npm notice integrity:     sha512-I2FufzKRdCY5U[...]g3o4rIEE6pG8Q==
npm notice total files:   35    

  

9.至此发布到私有仓库成功,查看包信息

技术图片

 

 

9.本地安装测试成功

cnpm i @winyh-vue

 

log 

Recently updated (since 2019-11-28): 3 packages (detail see file /Users/winyh/Desktop/PLG/pkg/node_modules/.recently_updates.txt)
  Today:
    → @cnpm/winyh-vue@*(0.0.1) (12:30:06)
? All packages installed (47 packages installed from npm registry, used 3s(network 2s), speed 54.51kB/s, json 46(131.27kB), tarball 0B)

  

以上是关于Docker 搭建本地 cnpm 私有仓库的主要内容,如果未能解决你的问题,请参考以下文章

Docker 搭建本地私有仓库

docker——docker搭建本地私有仓库

Docker容器之搭建本地私有仓库

Docker------搭建本地私有仓库及Horbor私有仓库

Docker------搭建本地私有仓库及Horbor私有仓库

Docker 搭建本地私有仓库 与 Harbor