使用Verdaccio搭建NPM私服
2022.03.08
PKAQ
前端
 热度
℃
共
1.编写配置
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
listen: - 0.0.0.0:4873
storage: ./storage
plugins: ./plugins
logs: - { type: stdout, format: pretty, level: http }
auth: htpasswd: file: ./htpasswd max_users: -1
packages: yytech: access: $authenticated publish: $authenticated '@*/*': access: $all publish: $authenticated proxy: npmjs
'**': access: $all publish: $authenticated proxy: npmjs
uplinks: npmjs: url: https://registry.npmjs.org/
middlewares: audit: enabled: true
web: enable: true title: Verdaccio 私有仓库
security: api: jwt: sign: expiresIn: 7d web: sign: expiresIn: 7d
headers: Cache-Control: no-store
|
2.创建用户
使用Htpasswd Generator – Create htpasswd - hostingcanada.org创建一个用户名/密码摘要 ,把生成的内容存放到 conf/htpasswd 文件中
3.创建镜像
1 2 3 4 5 6 7
| docker run -d \ --restart=always \ --name verdaccio \ -v /opt/docker_data/verdaccio/storage:/verdaccio/storage \ -v /opt/docker_data/verdaccio/conf:/verdaccio/conf \ -p 4873:4873 \ verdaccio/verdaccio
|