从Docker容器内部发布NPM软件包

时间:2019-07-01 14:36:23

标签: node.js git docker npm

我非常想将我的NPM软件包发布到我们的NPM回购中。 我不断收到错误消息,指出我的工作目录不干净,无法理解。

这是我的Dockerfile:

FROM node:12

ARG VERSION

COPY .npmrc /root/.npmrc
COPY .gitconfig /root/.gitconfig
COPY .git-credentials /root/.git-credentials

WORKDIR /home/node/app/

COPY package.json package.json

RUN npm install

COPY . .

RUN npm run release:testless -- ${VERSION}

package.json:

  "scripts": {
    "prepare": "npm run prepare:util",
    "prepare:util": "npm explore vl-ui-util -- npm run install:copy",
    "test": "wct -l chrome,firefox --npm",
    "release": "npm run release:prepare && np",
    "release:prepare": "npm run release:prepare:build",
    "release:prepare:build": "npm run build",
    "release:prepare:commit": "git add -f vl-map.js && git commit --amend --no-edit && git pull",
    "release:testless": "npm run release:prepare && np --yolo",
    "demo": "npm run dev",
    "dev": "concurrently \"npm:bundle:watch\" \"http-server\"",
    "build": "npm run bundle:build",
    "bundle:watch": "rollup --config rollup.config.js --watch",
    "bundle:build": "rollup --config rollup.config.js"
  }

结果是:

npm ERR! Git working directory not clean.

1 个答案:

答案 0 :(得分:0)

我通过在容器内进行克隆而不是让Bamboo进行克隆并将所有源文件复制到容器中来解决此问题。