{"id":19494122,"url":"https://github.com/langri-sha/npm_lazy","last_synced_at":"2025-04-25T20:31:31.919Z","repository":{"id":25815387,"uuid":"29254479","full_name":"langri-sha/npm_lazy","owner":"langri-sha","description":"A Docker container to speed up your NPM deploys http://mixu.net/npm_lazy/","archived":false,"fork":false,"pushed_at":"2017-04-04T21:44:40.000Z","size":36,"stargazers_count":11,"open_issues_count":3,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-04T03:11:56.237Z","etag":null,"topics":["docker-container","javascript","registries"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/langri-sha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-01-14T16:45:40.000Z","updated_at":"2022-07-19T13:25:32.000Z","dependencies_parsed_at":"2022-07-24T07:15:05.632Z","dependency_job_id":null,"html_url":"https://github.com/langri-sha/npm_lazy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langri-sha%2Fnpm_lazy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langri-sha%2Fnpm_lazy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langri-sha%2Fnpm_lazy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/langri-sha%2Fnpm_lazy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/langri-sha","download_url":"https://codeload.github.com/langri-sha/npm_lazy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250890454,"owners_count":21503497,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-container","javascript","registries"],"created_at":"2024-11-10T21:28:32.618Z","updated_at":"2025-04-25T20:31:31.642Z","avatar_url":"https://github.com/langri-sha.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker npm_lazy\n\nAdd this Docker container to your orchestration and enjoy near-instantaneous package dependency resolutions, courtesy of [mixu's lazy npm cache][npm_lazy] (repository [mixu/npm_lazy]).\n\n## Usage\n\nIn order to utilize the container's service, you'll have to configure the server's settings and also direct your local `npm` clients to use it as it's source for registry data.\n\nThere are two ways you can use the containerized `npm_lazy` server:\n\n- by mapping the server's port locally, exposing it within your host environment\n- by linking it to other containers\n\n### Using the server from your local host\n\nThe server defaults are configured to play nicely with local setups, i.e. when you want the `npm` client from your host to retrieve the packages through the cache from the running container.\n\nThe only important thing you need to do is to map the default exposed port from the container to the same port on your host:\n\n```\n# Start a detached container, mapping the exposed port locally\nsudo docker run -d -p 8080:8080 langrisha/npm-lazy\n```\n\nYou can verify that the service is then accessible from your host via:\n\n```\n$ curl http://localhost:8080\n{\"db_name\":\"registry\"}\n```\n\n### Linking with other containers\n\nIf you would like containers residing on your host to use the `npm_lazy` server, give your container a hostname and add your configuration module to the container.\n\nThen, configure the `npm` clients on all the linked containers and configure their registries to point to the `npm_lazy` host.\n\nHere's a high-level overview using [`fig.sh`](http://fig.sh):\n\n```\nweb:\n  image: google/nodejs\n  environment:\n    - npm_config_registry=http://npmlazy\n  links:\n    - npmlazy\nnpmlazy:\n  image: langrisha/npm-lazy\n  command: --show-config --port=80 --external-url=http://npmlazy\n```\n\n## Configuring the `npm_lazy` server\n\nThe `npm_lazy/server` is wrapped with a thin client that allows you to dynamically configure the server from the command-line options or the environment on startup.\n\nYou can configure the server by passing arguments when starting the container.\n\n```\n$ node index.js --help\n\n  Usage: index [options]\n\n  Starts a dynamically configured npm_lazy server instance\n\n  Options:\n\n    -h, --help                             output usage information\n    -V, --version                          output the version number\n    --show-config                          display the effective server configuration on startup\n    --logging-opts_log-to-console [value]\n    --logging-opts_log-to-file [value]\n    --logging-opts_filename [value]\n    --cache-directory [value]\n    --cache-age [value]\n    --http-timeout [value]\n    --max-retries [value]\n    --reject-unauthorized [value]\n    --external-url [value]\n    --remote-url [value]\n    --port [value]\n    --host [value]\n    --proxy_https [value]\n    --proxy_http [value]\n```\n\n### Environment variables\n\nAny environment variables that start with `NPM_LAZY_` will be interpreted as a configuration argument. For example, putting `NPM_LAZY_PORT=80` in your environment will set the `--port` argument to `80`. Environment variables are case-sensitive, so `npm_lazy_port` will not work.\n\n```\n$ export NPM_LAZY_CACHE_DIRECTORY=/tmp/npm_lazy\n$ export NPM_LAZY_EXTERNAL_URL=http://npm_lazy\n$ export NPM_LAZY_PORT=80\n$ node index.js\n```\n\n## Configuring the `npm` client\n\nThere are several ways you can configure the `npm` client, [outlined from official sources](https://docs.npmjs.com/misc/config).\n\nA few great examples involve configuring the environment:\n\n```\ndocker run -e npm_config_registry=http://localhost:8080 nodejsapp\n```\n\nor providing a project-specific `npmrc` file:\n\n```\n# myproj/.npmrc\nregistry = http://localhost:8080/\n```\n\n## Troubleshooting\n\nYou'll have to pay attention to the configured server's **port** and  **external URL**. The server's [provided defaults](https://github.com/mixu/npm_lazy/blob/master/config.js) configure the server to listen on *0.0.0.0:8080* and to be accessible from the URL *http://localhost:8080*.\n\nMake sure the networking requirements for the server are satisfied correctly and that the server running within your container matches the details of how it is accessed externally.\n\nYou can pass the `--show-config` container command to display the server's runtime configuration. Use `npm install --verbose` to get more output from the client and make sure the hosts for the package URLs when they're looked up and downloaded always match up.\n\n## See also\n\n- [npm_lazy project page][npm_lazy]\n- [mixu/npm_lazy repository][mixu/npm_lazy]\n- [npm_lazy configuration defaults (effectively applied)][config]\n- [configuring npm clients][npm-config]\n- [docker hub]\n- [docker source repository]\n\n# Changelog\n\n## [1.10.0] 2017-04-02\n\n- Update [mixu/npm_lazy] to 1.10.0\n\n## [1.9.0] 2017-04-02\n\n- Update [mixu/npm_lazy] to 1.9.0\n- Update container image to `node:4.8.1`\n- Use CCI 2.0\n\n## [1.8.0] 2016-09-01\n\n- Update [mixu/npm_lazy] to v1.8.0. Thanks @ralfschimmel!\n- Switch to official Node.js Docker image. Thanks @ralfschimmel!\n- Update Node.js version to v0.12\n- Add support for configuring via environment variables #17. Thanks @StanAngeloff!\n- Add basic tests\n\n## [1.7.0] 2015-02-16\n\n- Using Google's Node.js runtime image\n- Update [mixu/npm_lazy] to v1.7\n- Add usage examples\n- Add support for parsing command-line arguments\n\n## [1.0.0] 2015-01-23\n\n- Initial release\n- Use [mixu/npm_lazy] v1.7.0\n\n[1.10.0]: https://github.com/langri-sha/npm_lazy/compare/1.9.0...1.10.0\n[1.9.0]: https://github.com/langri-sha/npm_lazy/compare/1.8.0...1.9.0\n[1.8.0]: https://github.com/langri-sha/npm_lazy/compare/1.7.0...1.8.0\n[1.7.0]: https://github.com/langri-sha/npm_lazy/compare/3f1026213161bbe3fd959e82b353e3f2013a2fed...1.7.0\n[1.0.0]: https://github.com/langri-sha/npm_lazy/compare/b0d5587a136a8b87cc95578aa53714c58ec5bfb1...3f1026213161bbe3fd959e82b353e3f2013a2fed\n\n[npm_lazy]: http://mixu.net/npm_lazy/\n[mixu/npm_lazy]: https://github.com/mixu/npm_lazy\n[config]: https://github.com/mixu/npm_lazy/blob/master/config.js\n[npm-config]: https://docs.npmjs.com/misc/config\n[docker hub]: https://registry.hub.docker.com/u/langrisha/npm-lazy/\n[docker source repository]: https://github.com/langri-sha/npm_lazy/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flangri-sha%2Fnpm_lazy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flangri-sha%2Fnpm_lazy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flangri-sha%2Fnpm_lazy/lists"}