NPM& Docker Build

时间:2016-06-15 21:25:53

标签: gitlab-ci gitlab-ci-runner

我想"建立"我的npm构建并使用它创建一个docker镜像。这意味着我需要一个能够a)运行npm和b)运行docker的docker镜像 目前,我很难找到/创建这样的泊坞窗图像。我怎样才能解决我的问题呢? 谢谢!

修改
我设法有一个组合容器,但我的构建无法找到正在运行的docker实例:
Post http:///var/run/docker.sock/v1.20/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=registry.gitlab.com%2Ftss-repocar%2Fapp&ulimits=null: dial unix /var/run/docker.sock: no such file or directory. * Are you trying to connect to a TLS-enabled daemon without TLS? * Is your docker daemon up and running? Post http:///var/run/docker.sock/v1.20/images/registry.gitlab.com/tss-repocar/app/push?tag=: dial unix /var/run/docker.sock: no such file or directory. * Are you trying to connect to a TLS-enabled daemon without TLS? * Is your docker daemon up and running?

2 个答案:

答案 0 :(得分:0)

使用Packer。您在Packer中运行命令来执行所有NPM设置,它将吐出Docker容器。

这是包装工 https://www.packer.io/docs/

然后我发现了这个 https://www.npmjs.com/package/node-packer

答案 1 :(得分:0)

要构建docker镜像,您的构建容器必须能够访问/var/run/docker.sock(或者您必须在Docker中使用Docker)。

假设您在Docker容器中拥有gitlab-ci-multi-runner,请将/etc/gitlab-runner/config.toml更改为如下所示:

volumes = ["/var/run/docker.sock:/var/run/docker.sock", "/cache"]