-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <peter.somogyvari@accenture.com>
- Loading branch information
Showing
3 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM verdaccio/verdaccio:5.0.1 | ||
|
||
COPY ./config.yaml /verdaccio/conf/config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# test-npm-registry container image | ||
|
||
Used for locally verifying publishing commands before using them on npm publicly. | ||
The image is configured by default to not require any authentication at all and | ||
therefore it is a great fit for testing, but most never be used for production | ||
deployments of any kind. | ||
|
||
The reason why this image had to be created was because some of our packages | ||
that have front-end code embedded in them can take up more than 10MB in size | ||
and verdaccio by default does not allow bigger request payloads than that so | ||
we had to increase it to a higher limit via the configuration file `config.yaml`. | ||
|
||
## Usage | ||
|
||
1. Start the container and publish it's port `4873` to the host machine: | ||
```sh | ||
docker run -it --rm --publish 4873:4873 petermetz/cactus-test-npm-registry:1.0.0 | ||
``` | ||
2. Verify a canary publish with this container instead of using npmjs.com | ||
by specifying the registry URL as http://localhost:4873 such as | ||
```sh | ||
npx lerna publish \ | ||
--canary \ | ||
--force-publish \ | ||
--dist-tag $(git branch --show-current) \ | ||
--preid $(git branch --show-current).$(git rev-parse --short HEAD) \ | ||
--registry http://localhost:4873 | ||
``` | ||
|
||
## Build image locally: | ||
|
||
```sh | ||
DOCKER_BUILDKIT=1 docker build ./tools/docker/test-npm-registry/ -t ctnr | ||
``` | ||
|
||
## Run image locally | ||
|
||
```sh | ||
docker run -it --rm --publish 4873:4873 ctnr | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# | ||
# 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://github.com/verdaccio/verdaccio/blob/master/wiki/docker.md#docker-and-custom-port-configuration | ||
# | ||
# Look here for more config file examples: | ||
# https://github.com/verdaccio/verdaccio/tree/master/conf | ||
# | ||
|
||
# The only reason why we need a custom built docker image is because there is | ||
# no way to configure the existing container images to have a max body size | ||
# higher than the default 10 MB without mounting a volume with a config file | ||
max_body_size: 1000mb | ||
|
||
# path to a directory with all packages | ||
storage: /verdaccio/storage | ||
|
||
# a list of other known repositories we can talk to | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
|
||
packages: | ||
'@scope/*': | ||
# scoped packages | ||
access: $all | ||
publish: $all | ||
proxy: npmjs | ||
'@*/*': | ||
# scoped packages | ||
access: $all | ||
publish: $all | ||
proxy: npmjs | ||
'**': | ||
# 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 anyone to publish packages so there is no need to register a user | ||
publish: $all | ||
|
||
# if package is not available locally, proxy requests to 'npmjs' registry | ||
proxy: npmjs | ||
|
||
# log settings | ||
logs: | ||
- { type: stdout, format: pretty, level: trace } | ||
#- {type: file, path: verdaccio.log, level: info} | ||
|
||
listen: | ||
- 0.0.0.0:4873 |