0

I have been meeting a problem when I'm trying to build a docker container. My docker file is like

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

it will produce The command '/bin/sh -c grunt build' returned a non-zero code: 6

I have checked from here and speculating it might be related to ~/.known_host but I'm still working around to do the same approach. Could you please help how to fix?

For your information, docker stops at injector step and this was defined like below

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'
          ]
        }
      }
    },
Community
  • 1
  • 1
Bryan
  • 1,477
  • 1
  • 21
  • 38

1 Answers1

0

As you can find in the grunt,manual you have 6 status code, because you have a warning.

Posiable solutions are:

  1. Fix the warning.
  2. grunt build => grunt build --force
galkin
  • 5,264
  • 3
  • 34
  • 51