Grunt build inside Docker 容器返回了一个非零代码:6
Grunt build inside Docker Container returned a Non-zero code: 6
我在尝试构建 docker 容器时遇到了问题。我的 docker 文件类似于
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
我已经从 进行了检查,推测它可能与 ~/.known_host
有关,但我仍在努力采用相同的方法。你能帮忙解决一下吗?
供您参考,docker 在 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'
]
}
}
},
你可以在 grunt 中找到,manual 你有 6 个状态码,因为你有一个警告。
可能的解决方案是:
- 修复警告。
grunt build
=> grunt build --force
我在尝试构建 docker 容器时遇到了问题。我的 docker 文件类似于
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
我已经从 ~/.known_host
有关,但我仍在努力采用相同的方法。你能帮忙解决一下吗?
供您参考,docker 在 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'
]
}
}
},
你可以在 grunt 中找到,manual 你有 6 个状态码,因为你有一个警告。
可能的解决方案是:
- 修复警告。
grunt build
=>grunt build --force