
- 10.4.1-onbuild, 10.4-onbuild, 10-onbuild, onbuild (https://github.com/lgaticaq/node-build/blob/master/10.4.1/onbuild/Dockerfile)
- 10.4.1-ssh-onbuild, 10.4-ssh-onbuild, 10-ssh-onbuild, ssh-onbuild (https://github.com/lgaticaq/node-build/blob/master/10.4.1/ssh-onbuild/Dockerfile)
- 10.4.1-custom-registry-onbuild, 10.4-custom-registry-onbuild, 10-custom-registry-onbuild, custom-registry-onbuild (https://github.com/lgaticaq/node-build/blob/master/10.4.1/custom-registry-onbuild/Dockerfile)
- 9.11.2, 9.11, 9 (https://github.com/lgaticaq/node-build/blob/master/9.11.2/Dockerfile)
- 9.11.2-onbuild, 9.11-onbuild, 9-onbuild (https://github.com/lgaticaq/node-build/blob/master/9.11.2/onbuild/Dockerfile)
- 9.11.2-ssh-onbuild, 9.11-ssh-onbuild, 9-ssh-onbuild (https://github.com/lgaticaq/node-build/blob/master/9.11.2/ssh-onbuild/Dockerfile)
- 9.11.2-custom-registry-onbuild, 9.11-custom-registry-onbuild, 9-custom-registry-onbuild (https://github.com/lgaticaq/node-build/blob/master/9.11.2/custom-registry-onbuild/Dockerfile)
- 8.11.3, 8.11, 8 (https://github.com/lgaticaq/node-build/blob/master/8.11.3/Dockerfile)
- 8.11.3-onbuild, 8.11-onbuild, 8-onbuild (https://github.com/lgaticaq/node-build/blob/master/8.11.3/onbuild/Dockerfile)
- 8.11.3-ssh-onbuild, 8.11-ssh-onbuild, 8-ssh-onbuild (https://github.com/lgaticaq/node-build/blob/master/8.11.3/ssh-onbuild/Dockerfile)
- 8.11.3-custom-registry-onbuild, 8.11-custom-registry-onbuild, 8-custom-registry-onbuild (https://github.com/lgaticaq/node-build/blob/master/8.11.3/custom-registry-onbuild/Dockerfile)
- 6.14.3, 6.14, 6 (https://github.com/lgaticaq/node-build/blob/master/6.14.3/Dockerfile)
- 6.14.3-onbuild, 6.14-onbuild, 6-onbuild (https://github.com/lgaticaq/node-build/blob/master/6.14.3/onbuild/Dockerfile)
- 6.14.3-ssh-onbuild, 6.14-ssh-onbuild, 6-ssh-onbuild (https://github.com/lgaticaq/node-build/blob/master/6.14.3/ssh-onbuild/Dockerfile)
- 6.14.3-custom-registry-onbuild, 6.14-custom-registry-onbuild, 6-custom-registry-onbuild (https://github.com/lgaticaq/node-build/blob/master/6.14.3/custom-registry-onbuild/Dockerfile)
- 4.9.1, 4.9, 4 (https://github.com/lgaticaq/node-build/blob/master/4.9.1/Dockerfile)
- 4.9.1-onbuild, 4.9-onbuild, 4-onbuild (https://github.com/lgaticaq/node-build/blob/master/4.9.1/onbuild/Dockerfile)
- 4.9.1-ssh-onbuild, 4.9-ssh-onbuild, 4-ssh-onbuild (https://github.com/lgaticaq/node-build/blob/master/4.9.1/ssh-onbuild/Dockerfile)
- 4.9.1-custom-registry-onbuild, 4.9-custom-registry-onbuild, 4-custom-registry-onbuild (https://github.com/lgaticaq/node-build/blob/master/4.9.1/custom-registry-onbuild/Dockerfile)
镜像变体说明
- onbuild: 通用Node.js应用的Onbuild镜像,自动处理依赖安装与应用构建
- ssh-onbuild: 适用于包含私有依赖(git+ssh方式)的Node.js项目
- custom-registry-onbuild: 支持自定义npm registry(如verdaccio)的Node.js项目构建
使用场景
- 快速打包Node.js应用,生成轻量镜像
- 构建包含私有Git仓库依赖的Node项目
- 使用自定义npm源(如企业内部registry)的项目构建
配置说明
在Node.js项目根目录创建Dockerfile:
dockerfile
FROM lgatica/node-build:10-onbuild
# 替换为应用的默认端口
EXPOSE 3000
部署示例
构建并运行镜像:
bash
docker build -t my-nodejs-app .
docker run -it --rm --name my-running-app my-nodejs-app
注意事项
镜像假设项目根目录存在package.json文件,其中需列出依赖并定义启动脚本(如npm start)。
===FULL_DESC===