【发布时间】:2016-04-29 10:07:31
【问题描述】:
我在执行 Makefile 时遇到问题
部署.rb:
namespace :deploy do
after :deploy, :build_app do
on roles(:app), in: :groups do
execute "make production"
end
end
end
生成文件:
production:
echo "make file production"
staging:
echo "make file staging"
all:
echo "make file all"
运行“cap production deploy”时出错
DEBUG [1f0a117d] Command: make production
DEBUG [1f0a117d] make: *** No rule to make target `production'. Stop.
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as make production exit status: 2
make production stdout: make: *** No rule to make target `production'. Stop.
make production stderr: Nothing written
在服务器“make production”上直接调试运行 => echo“make file production”
如果只用“make”执行,它将运行到第一个标签
--- Makefile 添加
production:
npm install
npm run deploy-production
sudo docker rmi dashboard:latest; sudo echo 0
sudo docker build -t dashboard:$(VERSION) .
sudo docker tag -f dashboard:$(VERSION) dashboard:latest
staging:
npm install
npm run deploy-staging
sudo docker rmi dashboard:latest; sudo echo 0
sudo docker build -t dashboard:$(VERSION) .
sudo docker tag -f dashboard:$(VERSION) dashboard:latest
【问题讨论】:
-
您是否有理由通过 make 而不是简单的
cap production deploy运行它? -
是的。我需要运行它来构建一些代码(npm,docker image,...)。为了便于阅读,我删除了所有与错误无关的代码
-
你能发布 Makefile 源代码吗? (忽略这只是看到你做到了)
-
@microspino Makefile 添加
-
无论如何都可以在 Makefile 中获取 ENV。我想这样运行: npm run deploy-$(ENV) :D
标签: ruby-on-rails ubuntu makefile capistrano