Skip to content

Commit 19afe85

Browse files
committed
feat(tools): add test-npm-registry contaimer image
This is also tagged on DockerHub as petermetz/cactus-test-npm-registry:1.0.0 Signed-off-by: Peter Somogyvari <[email protected]>
1 parent 80c8253 commit 19afe85

File tree

3 files changed

+100
-0
lines changed

3 files changed

+100
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM verdaccio/verdaccio:5.0.1
2+
3+
COPY ./config.yaml /verdaccio/conf/config.yaml
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# test-npm-registry container image
2+
3+
Used for locally verifying publishing commands before using them on npm publicly.
4+
The image is configured by default to not require any authentication at all and
5+
therefore it is a great fit for testing, but most never be used for production
6+
deployments of any kind.
7+
8+
The reason why this image had to be created was because some of our packages
9+
that have front-end code embedded in them can take up more than 10MB in size
10+
and verdaccio by default does not allow bigger request payloads than that so
11+
we had to increase it to a higher limit via the configuration file `config.yaml`.
12+
13+
## Usage
14+
15+
1. Start the container and publish it's port `4873` to the host machine:
16+
```sh
17+
docker run -it --rm --publish 4873:4873 petermetz/cactus-test-npm-registry:1.0.0
18+
```
19+
2. Verify a canary publish with this container instead of using npmjs.com
20+
by specifying the registry URL as http://localhost:4873 such as
21+
```sh
22+
npx lerna publish \
23+
--canary \
24+
--force-publish \
25+
--dist-tag $(git branch --show-current) \
26+
--preid $(git branch --show-current).$(git rev-parse --short HEAD) \
27+
--registry http://localhost:4873
28+
```
29+
30+
## Build image locally:
31+
32+
```sh
33+
DOCKER_BUILDKIT=1 docker build ./tools/docker/test-npm-registry/ -t ctnr
34+
```
35+
36+
## Run image locally
37+
38+
```sh
39+
docker run -it --rm --publish 4873:4873 ctnr
40+
```
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#
2+
# This is the config file used for the docker images.
3+
# It allows all users to do anything, so don't use it on production systems.
4+
#
5+
# Do not configure host and port under `listen` in this file
6+
# as it will be ignored when using docker.
7+
# see https://github.com/verdaccio/verdaccio/blob/master/wiki/docker.md#docker-and-custom-port-configuration
8+
#
9+
# Look here for more config file examples:
10+
# https://github.com/verdaccio/verdaccio/tree/master/conf
11+
#
12+
13+
# The only reason why we need a custom built docker image is because there is
14+
# no way to configure the existing container images to have a max body size
15+
# higher than the default 10 MB without mounting a volume with a config file
16+
max_body_size: 1000mb
17+
18+
# path to a directory with all packages
19+
storage: /verdaccio/storage
20+
21+
# a list of other known repositories we can talk to
22+
uplinks:
23+
npmjs:
24+
url: https://registry.npmjs.org/
25+
26+
packages:
27+
'@scope/*':
28+
# scoped packages
29+
access: $all
30+
publish: $all
31+
proxy: npmjs
32+
'@*/*':
33+
# scoped packages
34+
access: $all
35+
publish: $all
36+
proxy: npmjs
37+
'**':
38+
# allow all users (including non-authenticated users) to read and
39+
# publish all packages
40+
#
41+
# you can specify usernames/groupnames (depending on your auth plugin)
42+
# and three keywords: "$all", "$anonymous", "$authenticated"
43+
access: $all
44+
45+
# allow anyone to publish packages so there is no need to register a user
46+
publish: $all
47+
48+
# if package is not available locally, proxy requests to 'npmjs' registry
49+
proxy: npmjs
50+
51+
# log settings
52+
logs:
53+
- { type: stdout, format: pretty, level: trace }
54+
#- {type: file, path: verdaccio.log, level: info}
55+
56+
listen:
57+
- 0.0.0.0:4873

0 commit comments

Comments
 (0)