{"id":13513802,"url":"https://github.com/astefanutti/scratch-node","last_synced_at":"2025-04-04T14:05:49.864Z","repository":{"id":33280626,"uuid":"157403471","full_name":"astefanutti/scratch-node","owner":"astefanutti","description":"Distroless Node.js Docker Images","archived":false,"fork":false,"pushed_at":"2022-10-21T15:54:32.000Z","size":98,"stargazers_count":853,"open_issues_count":2,"forks_count":45,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-03-28T13:06:28.309Z","etag":null,"topics":["distroless","docker","docker-image","dockerfile","musl","nodejs"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/astefanutti/scratch-node","language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/astefanutti.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":"2018-11-13T15:36:30.000Z","updated_at":"2025-01-20T01:57:01.000Z","dependencies_parsed_at":"2023-01-15T00:21:22.605Z","dependency_job_id":null,"html_url":"https://github.com/astefanutti/scratch-node","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fscratch-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fscratch-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fscratch-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astefanutti%2Fscratch-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astefanutti","download_url":"https://codeload.github.com/astefanutti/scratch-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190166,"owners_count":20898697,"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":["distroless","docker","docker-image","dockerfile","musl","nodejs"],"created_at":"2024-08-01T05:00:37.974Z","updated_at":"2025-04-04T14:05:49.836Z","avatar_url":"https://github.com/astefanutti.png","language":"Dockerfile","readme":"# Distroless Node.js Docker Images\n\nMulti-architecture distroless Node.js Docker images.\n\n## Content\n\n* The Node.js binary, statically linked using [_musl_](https://musl.libc.org), with opt-in support for i18n data\n* The _musl_ dynamic linker, to support native modules\n* A `/etc/passwd` entry for a `node` user\n\n## Images\n\nMulti-architecture images for `amd64`, `arm32v6`, `arm32v7` and `arm64v8`:\n\n* `latest`, `18`, `18.10`, `18.10.0` – 18.7 MB / 47.5 MB\n* `17`, `17.7`, `17.7.2` – 17.9 MB / 46.4 MB\n* `16`, `16.14`, `16.14.2` – 17.1 MB / 43.0 MB\n* `15`, `15.14`, `15.14.0` – 16.7 MB / 42.7 MB\n* `14`, `14.17`, `14.17.0` – 15.9 MB / 41.7 MB\n* `13`, `13.14`, `13.14.0` – 14.8 MB / 39.0 MB\n* `12`, `12.22`, `12.22.1` – 15.2 MB / 39.8 MB\n* `10`, `10.22`, `10.22.0` – 13.3 MB / 34.1 MB\n* `8`, `8.17`, `8.17.0` – 11.2 MB / 30.1 MB\n\nThe image sizes are _compressed_ / _unpacked_.\nThey are published to the following repositories:\n* [docker.io/astefanutti/scratch-node](https://hub.docker.com/r/astefanutti/scratch-node)\n* [ghcr.io/astefanutti/scratch-node](https://github.com/users/astefanutti/packages/container/package/scratch-node)\n* [quay.io/astefanutti/scratch-node](https://quay.io/repository/astefanutti/scratch-node)\n\n## Usage\n\n```dockerfile\nFROM node as builder\n\nWORKDIR /app\n\nCOPY package.json package-lock.json index.js ./\n\nRUN npm install --prod\n\nFROM astefanutti/scratch-node\n\nCOPY --from=builder /app /\n\nENTRYPOINT [\"node\", \"index.js\"]\n```\n\n### Native modules\n\nNative modules need to be statically compiled with _musl_ to be loadable.\nThis can easily be achieved by updating the above example with:\n\n```dockerfile\nFROM node:alpine as builder\n\nRUN apk update \u0026\u0026 apk add make g++ python\n\nWORKDIR /app\n\nCOPY package.json package-lock.json index.js ./\n\nRUN LDFLAGS='-static-libgcc -static-libstdc++' npm install --build-from-source=\u003cnative_module\u003e\n\nFROM astefanutti/scratch-node\n\nCOPY --from=builder /app /\n\nENTRYPOINT [\"node\", \"index.js\"]\n```\n\n### Internationalization\n\nThe Node binaries are linked against the ICU library statically, and include a subset of ICU data (typically only the English locale) to keep the image sizes small.\nAdditional locales data can be provided if needed, so that methods work for all ICU locales.\nIt can be made available to ICU by retrieving the locales data from the ICU sources, e.g.:\n\n```dockerfile\nFROM alpine as builder\n\nRUN apk update \u0026\u0026 apk add curl\n\n# Note the exact version of icu4c that's compatible depends on the Node version!\nRUN curl -Lsq -o icu4c-71_1-src.zip https://github.com/unicode-org/icu/releases/download/release-71-1/icu4c-71_1-src.zip \\\n    \u0026\u0026 unzip -q icu4c-71_1-src.zip\n\nFROM astefanutti/scratch-node:18.10.0\n\nCOPY --from=builder /icu/source/data/in/icudt71l.dat /icu/\n\nENV NODE_ICU_DATA=/icu\n```\n\nMore information can be found in the [Providing ICU data at runtime](https://nodejs.org/api/intl.html#intl_providing_icu_data_at_runtime) from the Node.js documentation.\n\n## Build\n\nThe image can be built by executing the following commands:\n\n```console\n$ git clone https://github.com/astefanutti/scratch-node\n$ cd scratch-node\n$ docker build --build-arg version=\u003cnodejs_version\u003e --build-arg arch=\u003ctarget_architecture\u003e .\n```\n","funding_links":[],"categories":["Dockerfile"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastefanutti%2Fscratch-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastefanutti%2Fscratch-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastefanutti%2Fscratch-node/lists"}