最小的Node.js Docker镜像(

网友投稿 1178 2022-11-03

最小的Node.js Docker镜像(<15MB)

最小的Node.js Docker镜像(

Scratch Node.js Docker Images

Smallest Node.js Docker images.

Content

A statically linked Node.js binaryThe musl dynamic linker to support native modulesA /etc/passwd entry for a node user

Images

Multi-architecture images for amd64, arm32v6, arm32v7 and arm64v8:

latest, 12, 12.2, 12.2.0 – 12 MB / 31 MB10, 10.15, 10.15.3 – 11 MB / 27.6 MB8, 8.16, 8.16.0 – 10 MB / 25.2 MB

The image sizes are - compressed / unpacked.

Usage

FROM node as builderWORKDIR /appCOPY package.json package-lock.json index.js ./RUN npm install --prodFROM astefanutti/scratch-nodeCOPY --from=builder /app /ENTRYPOINT ["node", "index.js"]

Note that native modules need to be statically compiled with musl to be loadable. This can easily be achieved by updating the above example with:

FROM node:alpine as builderRUN apk update && apk add make g++ python...RUN LDFLAGS='-static-libgcc -static-libstdc++' npm install --build-from-source=FROM astefanutti/scratch-node...

Build

The image can be built by executing the following commands:

$ git clone https://github.com/astefanutti/scratch-node& cd scratch-node$ docker build --build-arg version= --build-arg arch= .

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:frp配置使用,内网穿透
下一篇:easy_swoole获取指定的列
相关文章

 发表评论

暂时没有评论,来抢沙发吧~