【docker npm】npm 私库

embedded/2024/9/25 23:11:42/

1.部署环境

  • window 11 x64
  • Docker Desktop 4.34.1 (166053)
    • Docker Engine v27.2.0

1.1.Docker 镜像源

1.1.1.Docker Engine 配置

{"builder": {"features": {"buildkit": true},"gc": {"defaultKeepStorage": "32GB","enabled": true}},"experimental": true, "hosts": ["tcp://0.0.0.0:2375"],"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn","https://registry.docker-cn.com","http://hub-mirror.c.163.com","https://mirror.ccs.tencentyun.com"]
}

2.拉取Nexus3镜像

# 拉取镜像
docker pull verdaccio/verdaccio:latest
# 保存镜像源(选)
docker save -o verdaccio_verdaccio_latest verdaccio/verdaccio:latest

3.创建并运行Nexus3

docker run -it -d --name npmmirror -p 4873:4873 -v D:\docker\npm\verdaccio\storage:/verdaccio/storage -v D:\docker\npm\verdaccio\conf:/verdaccio/conf -v D:\docker\npm\verdaccio\plugins:/verdaccio/plugins --privileged=true --restart=always verdaccio/verdaccio

说明

  • --privileged=true 允许容器使用管理员权限
  • --restart=always 自动重启

config.yaml

#
# This is the config file used for the docker images.
# It allows all users to do anything, so don't use it on production systems.
#
# Do not configure host and port under `listen` in this file
# as it will be ignored when using docker.
# see https://verdaccio.org/docs/en/docker#docker-and-custom-port-configuration
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/master/conf
## path to a directory with all packages
storage: /verdaccio/storage/data
# path to a directory with plugins to include
plugins: /verdaccio/pluginsweb:# WebUI is enabled as default, if you want disable it, just uncomment this line#enable: falsetitle: NPM 私库# comment out to disable gravatar support# gravatar: false# by default packages are ordercer ascendant (asc|desc)# sort_packages: asc# darkMode: true# logo: http://somedomain/somelogo.png# favicon: http://somedomain/favicon.ico | /path/favicon.ico# rateLimit:#   windowMs: 1000#   max: 10000# translate your registry, api i18n not available yet
# i18n:
# list of the available translations https://github.com/verdaccio/ui/tree/master/i18n/translations
#   web: zh-CNauth:htpasswd:file: /verdaccio/storage/htpasswd# Maximum amount of users allowed to register, defaults to "+infinity".# You can set this to -1 to disable registration.max_users: 100# a list of other known repositories we can talk to
uplinks:cnpmjs:url: http://registry.npm.taobao.org/npmjs:url: https://registry.npmmirror.com/packages:'@*/*':# scoped packagesaccess: $allpublish: $authenticatedunpublish: $authenticatedproxy: cnpmjs'**':# allow all users (including non-authenticated users) to read and# publish all packages## you can specify usernames/groupnames (depending on your auth plugin)# and three keywords: "$all", "$anonymous", "$authenticated"access: $all# allow all known users to publish/publish packages# (anyone can register by default, remember?)publish: $authenticatedunpublish: $authenticated# if package is not available locally, proxy requests to 'npmjs' registryproxy: cnpmjs# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections.
# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout.
# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough.
server:keepAliveTimeout: 60middlewares:audit:enabled: true# log settings
logs: { type: stdout, format: pretty, level: http }
#experiments:
#  # support for npm token command
#  token: false
#  # enable tarball URL redirect for hosting tarball with a different server, the tarball_url_redirect can be a template string
#  tarball_url_redirect: 'https://mycdn.com/verdaccio/${packageName}/${filename}'
#  # the tarball_url_redirect can be a function, takes packageName and filename and returns the url, when working with a js configuration file
#  tarball_url_redirect(packageName, filename) {
#    const signedUrl = // generate a signed url
#    return signedUrl;
#  }# This affect the web and api (not developed yet)
i18n:web: zh-CN

htpasswd

登录的用户名和密码: admin/123456

admin:POhfqY8PVG4gA:autocreated 2023-09-06T11:01:37.149Z

初次运行容器后,将上面两个文件覆盖到挂载的本地文件,然后重新启动

npm_167">4.使用npm私库

# 登录
npm login --registry http://xxx.xxx.xxx.xxx:4873/
# 发布
npm publish --registry http://xxx.xxx.xxx.xxx:4873/
# 删包
npm unpublish xxx --registry http://xxx.xxx.xxx.xxx:4873/
npm unpublish xxx@1.0.0 --registry http://xxx.xxx.xxx.xxx:4873/
# 查看本地仓库
npm config get registry
# 设置本地仓库(选)
npm config set registry "http://xxx.xxx.xxx.xxx:4873/"pnpm set registry http://xxx.xxx.xxx.xxx:4873/
yarn config set registry http://xxx.xxx.xxx.xxx:4873/

http://www.ppmy.cn/embedded/111489.html

相关文章

下一代 AI 教育:知识图谱RAG + 多智能体,听老师的话没前途,让老师听你的才是正道

下一代 AI 教育:知识图谱RAG 多智能体,听老师的话没前途,让老师听你的才是正道 下一代 AI 教育:基于最本质的用脑方式学习 理解 记忆?学习的 3 个层次文科:关联理解 关联分析 关联记忆秒背古诗古文商业…

《响应式 Web 设计:纯 HTML 和 CSS 的实现技巧》

一、引言 在当今数字化时代,人们使用各种不同的设备访问网页,包括台式电脑、笔记本电脑、平板电脑和智能手机等。为了确保网页在不同设备上都能提供良好的用户体验,响应式 Web 设计变得至关重要。响应式 Web 设计是一种能够根据设备屏幕大小和…

从 Greenplum 到 Databend,数据仓库的开源新选择

Greenplum 是知名开源数据仓库项目,曾是大数据分析领域的明星产品,在全球范围内尤其是在国内市场上有着重要的地位。今年 6 月, Greenplum 的 GitHub 仓库突然被改为归档模式,访问权限也修改为只读,用户将失去对源代码…

Web开发详解

要做Web开发,就好像你在厨房里要做一顿丰盛的晚餐,从准备食材到最后上桌,整个过程得协调得当。Web开发的流程有前端、后端、数据库、API,以及其他的工具和技术来共同组成。别担心,听起来复杂,但我会给你讲得…

GAN及其变体

GAN是一种无监督学习 GAN及其变体论文汇总 hindupuravinash/the-gan-zoo:所有命名的 GAN 列表! (github.com) GAN及其变体代码汇总 eriklindernoren/Keras-GAN: Keras implementations of Generative Adversarial Networks. (github.com) 1. 经典GAN goodfeli/adversarial…

重要涉密文件如何防窃取?一分钟了解这5个有效的办法,超实用!

在信息化时代,重要涉密文件承载着企业的核心业务机密、技术专利和敏感客户信息等关键数据。 一旦这些文件被不法分子窃取,不仅会导致无法估量的经济损失,还会严重损害企业的声誉。 因此,构建一个全面的防护体系来防止涉密文件被…

基于Spring Boot的能源管理系统+建筑能耗+建筑能耗监测系统+节能监测系统+能耗监测+建筑能耗监测

建筑能耗数据采集器是一种采用嵌入式微计算机系统的建筑能耗数据采集专用装置,具有数据采集、数据处理、数据 存储、数据传输以及现场设备运行状态监控和故障诊断等功能。 下行具有2路RS485接口、2路RS485/RS232复用接口、1路MBUS接口,支持DL/T645、Modb…

leetcode 每日一题

2398.预算内最多的机器人数目 2024年9月13日 滑动窗口单调队列: 题目里表述的不太清楚,连续工作的机器人,就是求满足条件的最长子数组;这题可以说是滑动窗口最大值的进阶版本。 关于滑动窗口不要自己想当然的写,是有…