2016-11-30 27 views
0

我在試圖構建Docker容器時遇到了一個問題。我的搬運工文件就像Docker Container內的Grunt內部版本返回非零代碼:6

FROM ubuntu:16.04 
# ... RUN apt-get update && install ... 

EXPOSE 3005 

WORKDIR /usr/src/app 
RUN npm install forever -g && \ 
    npm install -g bower && \ 
    npm install -g grunt-cli 
COPY . . 
RUN npm install && bower install --allow-root 
RUN grunt build 

WORKDIR /usr/src/app/dist 
CMD NODE_ENV=${APP_ENV} forever start --uid "my_app" --append server/app.js 

會產生The command '/bin/sh -c grunt build' returned a non-zero code: 6

我從here檢查,並推測它可能與~/.known_host但我還在身邊做同樣的做法。你能幫我解決一下嗎?

爲了您的信息,搬運工停在injector一步,這被定義像下面

injector: { 
     options: { 

     }, 
     // Inject application script files into index.html (doesn't include bower) 
     scripts: { 
     options: { 
      transform: function(filePath) { 
      filePath = filePath.replace('/client/', ''); 
      filePath = filePath.replace('/.tmp/', ''); 
      return '<script src="' + filePath + '"></script>'; 
      }, 
      starttag: '<!-- injector:js -->', 
      endtag: '<!-- endinjector -->' 
     }, 
     files: { 
      '<%= yeoman.client %>/index.html': [ 
       ['{.tmp,<%= yeoman.client %>}/{app,components}/**/*.js', 
       '!{.tmp,<%= yeoman.client %>}/app/app.js', 
       '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.spec.js', 
       '!{.tmp,<%= yeoman.client %>}/{app,components}/**/*.mock.js'] 
      ] 
     } 
     }, 

     // Inject component scss into app.scss 
     sass: { 
     options: { 
      transform: function(filePath) { 
      filePath = filePath.replace('/client/app/', ''); 
      filePath = filePath.replace('/client/components/', ''); 
      return '@import \'' + filePath + '\';'; 
      }, 
      starttag: '// injector', 
      endtag: '// endinjector' 
     }, 
     files: { 
      '<%= yeoman.client %>/app/app.scss': [ 
      '<%= yeoman.client %>/{app,components}/**/*.{scss,sass}', 
      '!<%= yeoman.client %>/app/app.{scss,sass}' 
      ] 
     } 
     }, 

     // Inject component css into index.html 
     css: { 
     options: { 
      transform: function(filePath) { 
      filePath = filePath.replace('/client/', ''); 
      filePath = filePath.replace('/.tmp/', ''); 
      return '<link rel="stylesheet" href="' + filePath + '">'; 
      }, 
      starttag: '<!-- injector:css -->', 
      endtag: '<!-- endinjector -->' 
     }, 
     files: { 
      '<%= yeoman.client %>/index.html': [ 
      '<%= yeoman.client %>/{app,components}/**/*.css' 
      ] 
     } 
     } 
    }, 
+0

我沒有看到你Dockerfile的APP_ENV的定義,所以... – user2915097

+0

當我運行搬運工容器像'搬運工運行my_image -e APP_ENV = prod' – Bryan

+0

我會通過無,你不能這樣做,構建需要定義這個環境變量 – user2915097

回答

0

正如你在繁重的發現,manual你有6個狀態代碼,因爲你有一個警告。

Posiable的解決方案是:

  1. 修復警告。
  2. grunt build =>grunt build --force
相關問題