当前位置: 首页 > news >正文

Docker 部署 verdaccio 搭建 npm 私服

一、镜像获取

# 获取 verdaccio 镜像
docker pull verdaccio/verdaccio

二、修改配置文件

cd /wwwroot/opt/docker/verdaccio/conf
vim config.yaml

config.yaml 配置文件如下,可以根据自己的需要进行修改

#
# This is the default configuration file. It allows all users to do anything,
# please read carefully the documentation and best practices to
# improve security.
#
# Look here for more config file examples:
# https://github.com/verdaccio/verdaccio/tree/5.x/conf
#
# Read about the best practices
# https://verdaccio.org/docs/best# path to a directory with all packages
storage: ./storage
# path to a directory with plugins to include
plugins: ./plugins# https://verdaccio.org/docs/webui
web:title: Verdaccio# comment out to disable gravatar support# gravatar: false# by default packages are ordercer ascendant (asc|desc)# sort_packages: asc# convert your UI to the dark side# darkMode: true# html_cache: true# by default all features are displayed# login: true# showInfo: true# showSettings: true# In combination with darkMode you can force specific theme# showThemeSwitch: true# showFooter: true# showSearch: true# showRaw: true# showDownloadTarball: true#  HTML tags injected after manifest <scripts/># scriptsBodyAfter:#    - '<script type="text/javascript" src="https://my.company.com/customJS.min.js"></script>'#  HTML tags injected before ends </head>#  metaScripts:#    - '<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>'#    - '<script type="text/javascript" src="https://browser.sentry-cdn.com/5.15.5/bundle.min.js"></script>'#    - '<meta name="robots" content="noindex" />'#  HTML tags injected first child at <body/>#  bodyBefore:#    - '<div id="myId">html before webpack scripts</div>'#  Public path for template manifest scripts (only manifest)#  publicPath: http://somedomain.org/# https://verdaccio.org/docs/configuration#authentication
auth:htpasswd:file: ./htpasswd# Maximum amount of users allowed to register, defaults to "+inf".# You can set this to -1 to disable registration.# max_users: 1000# https://verdaccio.org/docs/configuration#uplinks
# a list of other known repositories we can talk to
uplinks:taobao:                                                                                                    url: https://registry.npm.taobao.org/npmjs:url: https://registry.npmjs.org/yarnkg: url: https://registry.yarnpkg.com/tencent:url: https://mirrors.cloud.tencent.com/npm/cnpm:url: https://r.cnpmjs.org/npmMirror:url: https://skimdb.npmjs.com/registry/
# Learn how to protect your packages
# https://verdaccio.org/docs/protect-your-dependencies/
# https://verdaccio.org/docs/configuration#packages
packages:'@*/*':# scoped packagesaccess: $allpublish: $authenticatedunpublish: $authenticatedproxy: taobao'**':# 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: taobao# To improve your security configuration and  avoid dependency confusion
# consider removing the proxy property for private packages
# https://verdaccio.org/docs/best#remove-proxy-to-increase-security-at-private-packages# https://verdaccio.org/docs/configuration#server
# 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: 60# https://verdaccio.org/docs/configuration#offline-publish
# publish:
#   allow_offline: false# https://verdaccio.org/docs/configuration#url-prefix
# url_prefix: /verdaccio/
# VERDACCIO_PUBLIC_URL='https://somedomain.org';
# url_prefix: '/my_prefix'
# // url -> https://somedomain.org/my_prefix/
# VERDACCIO_PUBLIC_URL='https://somedomain.org';
# url_prefix: '/'
# // url -> https://somedomain.org/
# VERDACCIO_PUBLIC_URL='https://somedomain.org/first_prefix';
# url_prefix: '/second_prefix'
# // url -> https://somedomain.org/second_prefix/'# https://verdaccio.org/docs/configuration#security
# security:
#   api:
#     legacy: true
#     jwt:
#       sign:
#         expiresIn: 29d
#       verify:
#         someProp: [value]
#    web:
#      sign:
#        expiresIn: 1h # 1 hour by default
#      verify:
#         someProp: [value]# https://verdaccio.org/docs/configuration#user-rate-limit
# userRateLimit:
#   windowMs: 50000
#   max: 1000# https://verdaccio.org/docs/configuration#max-body-size
max_body_size: 50mb# https://verdaccio.org/docs/configuration#listen-port
listen:- '0.0.0.0:4873'              # listen on all addresses (INADDR_ANY)
# - https://example.org:4873  # if you want to use https
# - "[::1]:4873"                # ipv6
# - unix:/tmp/verdaccio.sock    # unix socket# The HTTPS configuration is useful if you do not consider use a HTTP Proxy
# https://verdaccio.org/docs/configuration#https
# https:
#   key: ./path/verdaccio-key.pem
#   cert: ./path/verdaccio-cert.pem
#   ca: ./path/verdaccio-csr.pem# https://verdaccio.org/docs/configuration#proxy
# http_proxy: http://something.local/
# https_proxy: https://something.local/# https://verdaccio.org/docs/configuration#notifications
notify:method: POSTheaders: [{ "Content-Type": "application/json;charset=utf-8" }]# 发送消息的webhookendpoint: xxxcontent: '{ "msgtype": "text","at": { "isAtAll": true }, "text": {"content":"组件发版通知: {{ name }}{{#each versions}} v{{version}}{{/each}}"}}'middlewares:audit:enabled: true# https://verdaccio.org/docs/logger
# log settings
logs: { type: stdout, format: pretty, level: http }
#experiments:
#  # support for npm token command
#  token: false
#  # disable writing body size to logs, read more on ticket 1912
#  bytesin_off: false
#  # enable tarball URL redirect for hosting tarball with a different server, the tarball_url_redirect can be a template string
#  tarball_url_redirect: 'http://175.42.30.161:46803/verdaccio/${packageName}/${filename}'
#  tarball_url_redirect: 'http://175.42.30.161:46803/${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;
#  }# translate your registry, api i18n not available yet
i18n:
# list of the available translations https://github.com/verdaccio/verdaccio/blob/master/packages/plugins/ui-theme/src/i18n/ABOUT_TRANSLATIONS.mdweb: zh-CN

auth:
  htpasswd:
    file: ./htpasswd  # 是 npm 私服的用户密码文件

max_body_size: 50mb # 是推上私服的包的最大大小

listen:
 - '0.0.0.0:4873'   # 是监听的ip和端口,4873 就是后面访问的端口

notify:
   method: POST
   headers: [{ "Content-Type": "application/json;charset=utf-8" }]
   # 推包后发送消息的 webhook 地址,如没有则不用配置
   endpoint: xxx

三、创建容器并运行

docker run -d --name verdaccio \n
-p 4873:4873 \n
-v /wwwroot/opt/docker/verdaccio:/verdaccio \n
--privileged=true verdaccio/verdaccio 

四、测试运行

此时,verdaccio已经启动,http://ip:4873/ 已经可以访问

五、使用内网穿透 的 web界面坑

在搭建公司私有库时,使用的内网ip,但是为了在外面方便访问,运营将内网ip穿透得到一个外网可以访问的ip。但是不能使用内网ip和外网ip同时访问web页面。查看verdaccio的页面请求发现会将当天第一次请求的域名缓存起来。假设当天先访问内网环境域名,则外网环境web页面将无法访问,因为请求被写死成内网地址,如果先访问外网地址,则内网地址跳转到无包页面。

庆幸的是,这并不影响包的安装

相关文章:

Docker 部署 verdaccio 搭建 npm 私服

一、镜像获取 # 获取 verdaccio 镜像 docker pull verdaccio/verdaccio 二、修改配置文件 cd /wwwroot/opt/docker/verdaccio/conf vim config.yaml config.yaml 配置文件如下&#xff0c;可以根据自己的需要进行修改 # # This is the default configuration file. It all…...

49-拓展(1)

49-拓展&#xff08;1&#xff09; 扩展概述 扩展可以为在当前 package 可见的类型&#xff08;除函数、元组、接口&#xff09;添加新功能。 当不能破坏被扩展类型的封装性&#xff0c;但希望添加额外的功能时&#xff0c;可以使用扩展。 可以添加的功能包括&#xff1a; …...

国产编辑器EverEdit - 在文件中查找和替换

1 在文件中查找和替换 1.1 应用场景 某些场景&#xff0c;用户需要在所有工程文件中进行查找和替换关键词&#xff0c;比如&#xff1a;查找工程中哪些文件使用了某个常量。 1.2 使用方法 选择主菜单查找 -> 在文件中查找和替换&#xff0c;或使用快捷键Ctrl Shift F&a…...

安全行业大模型SecLLM技术白皮书

在ChatGPT 呈现全球现象级热度时&#xff0c;通用大语言模型&#xff08;Large Language Model, LLM&#xff09;技术成为了推动创新和变革的关键驱动力。但由于安全行业的特殊性和复杂性&#xff0c;LLM 并不能满足其应用需求。安全行业大模型(Security Large Language Model,…...

基础入门-HTTP数据包红蓝队研判自定义构造请求方法请求头修改状态码判断

知识点&#xff1a; 1、请求头&返回包-方法&头修改&状态码等 2、数据包分析-红队攻击工具&蓝队流量研判 3、数据包构造-Reqable自定义添加修改请求 一、演示案例-请求头&返回包-方法&头修改&状态码等 数据包 客户端请求Request 请求方法 …...

2025年日祭

本文将同步发表于洛谷&#xff08;暂无法访问&#xff09;、CSDN 与 Github 个人博客&#xff08;暂未发布&#xff09; 本蒟自2025.2.8开始半停课。 任务计划&#xff08;站外题与专题&#xff09; 数了一下&#xff0c;通过人数比较高的题&#xff0c;也就是我准备补的题&a…...

git命令行删除远程分支、删除远程提交日志

目录 1、从本地通过命令行删除远程git分支2、删除已 commit 并 push 的记录 1、从本地通过命令行删除远程git分支 git push origin --delete feature/feature_xxx 删除远程分支 feature/feature_xxx 2、删除已 commit 并 push 的记录 git reset --hard 7b5d01xxxxxxxxxx 恢复到…...

centOS8安装MySQL8设置开机自动启动失败

提供一个终极解决方案虽然systemctl 更符合管理预期但是不能用 使用一下命令 修改配置文件、修改mysql.service全是问题 systemctl start mysqld systemctl enable mysqld systemctl daemon-reload完全不生效各种报错 提示配置文件内容有问题 Main process exited, codeexite…...

对接DeepSeek

其实&#xff0c;整个对接过程很简单&#xff0c;就四步&#xff0c;获取key&#xff0c;找到接口文档&#xff0c;接口测试&#xff0c;代码对接。 获取 KEY https://platform.deepseek.com/transactions 直接付款就是了&#xff08;现在官网暂停充值2025年2月7日&#xff0…...

SpringSecurity高级用法

SpringSecurity的高级用法&#xff0c;包括自定义loginUrl携带参数&#xff0c;自定义认证校验逻辑&#xff0c;自定义权限校验逻辑。 示例项目 https://github.com/qihaiyan/springcamp/tree/master/spring-advanced-security 一、概述 在项目实际开发过程中&#xff0c;Spr…...

NLP_[2]-认识文本预处理

文章目录 1 认识文本预处理1 文本预处理及其作用2. 文本预处理中包含的主要环节2.1 文本处理的基本方法2.2 文本张量表示方法2.3 文本语料的数据分析2.4 文本特征处理2.5数据增强方法2.6 重要说明 2 文本处理的基本方法1. 什么是分词2 什么是命名实体识别3 什么是词性标注 1 认…...

字符设备驱动开发

驱动就是获取外设、传感器数据和控制外设。数据会提交给应用程序。 Linux 驱动编译既要编写一个驱动&#xff0c;还要编写一个简单的测试应用程序。 而单片机下驱动和应用都是放在一个文件里&#xff0c;也就是杂在一块。而 Linux 则是分开了。 一、字符设备驱动开发流程 Lin…...

c语言:取绝对值

假设我们有一个 long 类型的变量 l&#xff0c;我们希望恢复其绝对值。以下是两种方法的对比&#xff1a; 方法1&#xff1a;使用条件语句 这个很好理解&#xff0c;负数时取负运算 &#xff0c;用于数值的符号反转。 long abs_value(long l) {if (l < 0) {return -l;} e…...

DeepSeek从入门到精通教程PDF清华大学出版

DeepSeek爆火以来&#xff0c;各种应用方式层出不穷&#xff0c;对于很多人来说&#xff0c;还是特别模糊&#xff0c;有种雾里看花水中望月的感觉。 最近&#xff0c;清华大学新闻与传播学院新媒体研究中心&#xff0c;推出了一篇DeepSeek的使用教程&#xff0c;从最基础的是…...

HTML之CSS定位、浮动、盒子模型

HTML之CSS定位、浮动、盒子模型 定位 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document<…...

LQB(1)-python-各种基础排序

前言 除了内置的快速排序sort()&#xff0c;python也可以实现冒泡排序、选择排序、插入排序、快速排序、归并排序和桶排序。 一、冒泡排序 (Bubble Sort) 基础代码 def bubble_sort(arr):n len(arr)for i in range(n):swapped False # 优化&#xff1a;若本轮无交换则提前…...

解锁国内主流前端与后端框架

前端框架大揭秘 在当今的 Web 开发领域&#xff0c;前端框架的地位愈发举足轻重。随着用户对 Web 应用交互性和体验性要求的不断攀升&#xff0c;前端开发不再仅仅是简单的页面布局与样式设计&#xff0c;更需要构建复杂且高效的用户界面。前端框架就像是一位得力助手&#xf…...

使用OBS推流,srs服务器播放

说明&#xff1a; ffmpeg可以推流&#xff0c;但是是命令行方式不太友好&#xff0c;还可以使用主流的OBS开源推流软件&#xff0c;可从官网Open Broadcaster Software | OBS 下载最新版本&#xff0c;目前很多网络主播都是用它做直播。该软件支持本地视频文件以及摄像头推流。…...

【鸿蒙HarmonyOS Next实战开发】多媒体视频播放-ijkplayer

简介 ijkplayer是OpenHarmony和HarmonyOS环境下可用的一款基于FFmpeg的视频播放器。 演示 下载安装 ohpm install ohos/ijkplayer使用说明 import { IjkMediaPlayer } from "ohos/ijkplayer";import type { OnPreparedListener } from "ohos/ijkplayer";i…...

GRU 和 LSTM 公式推导与矩阵变换过程图解

GRU 和 LSTM 公式推导与矩阵变换过程图解 GRULSTM 本文的前置篇链接: 单向/双向&#xff0c;单层/多层RNN输入输出维度问题一次性解决 GRU GRU&#xff08;Gate Recurrent Unit&#xff09;是循环神经网络&#xff08;RNN&#xff09;的一种&#xff0c;可以解决RNN中不能长期…...

从一次生产事故复盘:我们如何优雅地处理用户上传的‘异常’Excel文件(附Apache POI配置详解)

从生产事故到防御体系&#xff1a;构建Excel文件处理的工程化解决方案那天凌晨2点&#xff0c;我被一阵急促的告警声惊醒。监控系统显示&#xff0c;核心文件处理服务的错误率在10分钟内飙升到35%&#xff0c;大量用户上传的Excel文件无法正常解析。更糟糕的是&#xff0c;部分…...

硬件答辩问题总结

一、电源纹波是什么&#xff0c;为什么LDO的小&#xff0c;DCDC的大1.电源纹波电源纹波 是指直流电源输出电压上叠加的 交流波动成分&#xff0c;表现为电压在理想直流值附近上下波动。2.LDO 纹波小原理LDO 内部是一个 调整管&#xff08;可变电阻&#xff09; 串联在输入和输出…...

Vue3 图片标框功能实现方案

基于 Vue3 组合式 API 的图片标框&#xff08;画框、标注、选框&#xff09;完整实现&#xff0c;核心逻辑封装在 GetBoxes 组件里&#xff0c;复制就能用 一、功能说明 ✅ 在图片上鼠标拖拽画矩形框 ✅ 实时显示框坐标&#xff08;x, y, width, height&#xff09; ✅ 支持多…...

Python基础语法:生成器 generator(yield)

一、简介根据指定的规则循环生成数据&#xff0c;当条件不成立时则生成数据结束。数据不是一次性全部生成出来&#xff0c;而是使用一个&#xff0c;再生成一个&#xff0c;好处是可以节约大量的内存。就像设计模式中的懒汉式。适合处理大数据或流数。生成器是一种特殊的迭代器…...

CentOS服务器上VNC连接失败?手把手教你排查并修复个人端口问题(附重启命令)

CentOS服务器VNC连接故障深度排查指南&#xff1a;从原理到实战当你在深夜赶项目时&#xff0c;突然发现VNC连接不上服务器&#xff0c;那种焦虑感我深有体会。去年参与半导体器件仿真项目时&#xff0c;我也曾被这个问题困扰整整两天。本文将分享一套经过实战检验的排查方法论…...

保姆级避坑指南:在Ubuntu 22.04上搞定ROS2 Humble、PX4与Gazebo的联合仿真(附Empy版本降级)

保姆级避坑指南&#xff1a;Ubuntu 22.04下ROS2 Humble与PX4联合仿真的21个关键陷阱当你在Ubuntu 22.04上第一次尝试搭建ROS2 Humble、PX4与Gazebo的联合仿真环境时&#xff0c;可能会遇到比预期更多的挑战。这不是一个简单的"复制粘贴命令就能完成"的任务——版本冲…...

巨量投放总结

巨量商务管理平台 &#xff1a; https://business.oceanengine.com 巨量广告投放平台&#xff1a; https://ad.oceanengine.com 商务管理平台 账户 广告组 计划 广告投放平台 层级关系: 广告组 -> 计划 -> 创意 对应FB: 系列 - > 广告组 -> 广告...

别再死磕USB HID了!用ESP32的Arduino框架手把手教你实现蓝牙鼠标键盘(附完整代码)

ESP32蓝牙HID实战&#xff1a;零基础打造自定义键盘鼠标 手里那块吃灰的ESP32开发板终于能派上用场了&#xff01;上周我用它做了个无线演示控制器&#xff0c;在会议室里走着就能翻PPT&#xff0c;同事们都问是怎么实现的。其实秘诀就在于ESP32的蓝牙HID功能——不需要任何USB…...

HarmonyOS 6学习:解决图片放大后无法移动至边缘的matrix4矩阵变换技巧

从"卡在中间"到"自由拖拽"&#xff1a;一次完整的图片缩放平移边界问题攻关在HarmonyOS 6应用开发中&#xff0c;我最近遇到了一个看似简单却让人头疼的图片查看器问题&#xff1a;用户双指放大图片后&#xff0c;想要拖动查看边缘细节&#xff0c;却发现图…...

Taotoken的审计日志功能为企业API安全与合规管理提供支持

&#x1f680; 告别海外账号与网络限制&#xff01;稳定直连全球优质大模型&#xff0c;限时半价接入中。 &#x1f449; 点击领取海量免费额度 Taotoken的审计日志功能为企业API安全与合规管理提供支持 当企业决定将大模型能力集成到内部业务流程中时&#xff0c;IT管理员和安…...