我正在尝试编写一个docker文件,它将运行一个RUN命令来搜索package.json文件中的一个单词并对其进行操作:
这是我简单的dockerfile:
FROM ubuntu:14.04
COPY package.json package.json
RUN if grep -q "grunt" package.json; then echo succeed fi
Run Code Online (Sandbox Code Playgroud)
正如你所看到的,我只想要一个简单的if语句,但它会出现这个错误:
Step 2 : RUN if grep -q "grunt" package.json; then echo succeed fi
---> Running in af460df45239
/bin/sh: 1: Syntax error: end of file unexpected (expecting "fi")
INFO[0001] The command [/bin/sh -c if grep -q "grunt" package.json; then echo succeed fi] returned a non-zero code: 2
Run Code Online (Sandbox Code Playgroud)
我该怎么办命令?谢谢.
惠,
我正在服务器端使用angular.js和node.js(Express.js)构建一个应用程序.
由于某种原因,我在处理删除请求时遇到问题.没有人到达服务器端.
这是我的angular.js资源代码:
$scope.deleteProject = function(projectName){
var postData = {username: 'name', projectName: projectName};
Project.deleteProject.delete({}, postData,
function(res){
alert('Project Deleted');
},
function(err){
alert(err.data);
});
}
Run Code Online (Sandbox Code Playgroud)
在服务器端我有这个:
var deleteProject = function(req, res){
console.log(req.body);
console.log(req.params);
if (req.body.projectName){
//do something
return res.send(200);
}
else
return res.send(400, 'no project name was specified');
}
Run Code Online (Sandbox Code Playgroud)
现在由于某种原因,根本没有身体!它是空的.我已将路线定义为app.delete.
如果我将node.js中的路由更改为post并在angular.js中保存它可以正常工作.
我在这里失踪了什么(敲打我的脑袋).
谢谢.
我试图找到所有现有Jasmine期望匹配器的列表,如'toContain'等...
我在哪里可以找到这个?我已经搜索了一段时间但找不到像api这样的东西.
Jasmine站点也没有任何排序列表.
使输入文本只接受0-9之间的数字的模式.
这是我的模式:
$scope.onlyNumbers = /[\u0030-\u0039]+/g;
Run Code Online (Sandbox Code Playgroud)
出于某种原因,即使不在我声明的范围内,也会接受像' - '这样的字符.
这是我的输入html:
<input style="width:40%;" type="text" name="phone" ng-minlength="10" ng-maxlength="15" ng-model="register.phone" placeholder='cell phone' ng-pattern="onlyNumbers" required title="please enter cell phone">
Run Code Online (Sandbox Code Playgroud)
有人可以帮忙吗?
我正在尝试构建一个Nginx映像,以使用ngx_http_auth_request_module模块安装nginx。
这是我当前的docker文件:
#ubuntu OS
FROM ubuntu:14.04
#update apt-get non interactive and install nginx
RUN \
sudo apt-get -q -y update; \
sudo apt-get -q -y install nginx
#copy all mapping configurations for all environments
COPY ./resources/routing-configs/* /routing-configs/
#expose port for nginx
EXPOSE 80
#run task to copy only relevant mapping configuration to nginx and reload nginx service
COPY ./resources/start.sh /opt/mysite/router/start.sh
RUN sudo chmod 766 /opt/mysite/router/start.sh
CMD sudo -E sh /opt/mysite/router/start.sh
Run Code Online (Sandbox Code Playgroud)
通常我会像这样在本地编译nginx文件:
sudo ./configure --with-http_auth_request_module
Run Code Online (Sandbox Code Playgroud)
然后安装nginx
sudo make install
Run Code Online (Sandbox Code Playgroud)
但是我该如何使用docker文件呢?
请帮忙
我使用 nginx 作为整个解决方案的单一入口点。
我的目标是在继续之前发送一些要进行身份验证的 url。
我找到了一个名为:的模块ngx_http_auth_request_module,它适合解决我的问题。
http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
我正在像这样编译我的 nginx: ./configure --with-http_auth_request_module
我的代码是这样的:
http {
server {
listen 8080 default_server;
server_name _;
location /api {
auth_request /auth;
proxy_pass http://localhost:8000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
location = /auth {
proxy_pass http://localhost:8000/auth/user;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,如果我的服务器返回并出错,例如401,则显示默认页面。我想要的是能够返回从我的身份验证服务返回的 json。没有这个,这是没用的。只显示一个通用401页面有什么意义?我想返回我的代理 json 响应。
请帮忙。
我正在使用 angular.js 构建一个表单。
我的表格看起来像:
<form name="registerForm" class="form-horizontal">
<div class="control-group">
<label class="control-label">?? ????</label>
<div class="controls">
<input type="text" ng-model="register.firstName" placeholder="?? ????" required>
</div>
</div>
<div class="control-group">
<label class="control-label">?? ?????</label>
<div class="controls">
<input type="text" ng-model="register.username" placeholder="?? ?????">
</div>
</div>
<div class="control-group">
<label class="control-label">???"?</label>
<div class="controls">
<input type="email" ng-model="register.email" placeholder='???"?'>
</div>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
我正在构建一个注册表,我将有 2 个字段:名字和姓氏,只能使用特定语言(不是英语)输入。解释:表格不接受除该语言之外的其他语言。
所有其他字段都必须是英文。
谢谢
我对bootstraps navbar 2.3.2有这个非常奇怪的问题.
这个问题也发生在他们的官方页面上:
http://getbootstrap.com/2.3.2/examples/starter-template.html
Run Code Online (Sandbox Code Playgroud)
导航栏在桌面上运行良好.
在每个网络浏览器上的手机上,我检查过每件事似乎工作得很好.
问题只发生在chrome mobile上.
在第一次点击菜单时,每件事都会显示并且正常.
当它折叠回来然后再次点击突然看到菜单时,内部元素变得不可见.如果你突然转动手机,它们会再次出现.
再次,这只在chrome mobile上haapens,就像我在url中给出的例子一样.
这很奇怪,我不想将我的网站移动到bootstrap 3.
请帮助我必须有一些可以解决这个问题的CSS.
谢谢.
我试图使用C语言从stdin读取未知长度行.
我在网上看到了这个:
char** str;
gets(&str);
Run Code Online (Sandbox Code Playgroud)
但它似乎给我带来了一些问题,我真的不明白如何以这种方式做到这一点.
你能解释一下为什么这个例子工作/不工作以及实现它的正确方法(用malloc吗?)
我的目标是编写一个新类来扩展 javascript 原生 Error 类,以支持更好的堆栈消息。
所以我想做的是仍然能够调用 error.stack 但获得更好的堆栈消息,其中还包括原始堆栈跟踪以及我自己的更多数据。
我不知道如何实现这个目标:
'use strict'
class MyError extends Error {
constructor(error) {
super(error);
}
get stack() {
return "extended" + this.stack;
}
}
var error = new MyError("my error");
console.log(error.stack);
Run Code Online (Sandbox Code Playgroud)
但我得到的只是原始堆栈消息,没有新数据。
angularjs ×3
javascript ×3
boot2docker ×2
docker ×2
c ×1
dockerfile ×1
ecmascript-6 ×1
express ×1
jasmine ×1
nginx ×1
node.js ×1
protractor ×1
regex ×1
shell ×1