capistrano excute Makefile失败

时间:2016-04-29 10:07:31

标签: ruby-on-rails ubuntu makefile capistrano

我的excute Makefile有问题

deploy.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"
运行"生产部署"

时出现

错误

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

1 个答案:

答案 0 :(得分:1)

make env的正确语法:

namespace :deploy do
  after :deploy, :build_app do
    on roles(:app), in: :groups do
      execute 'make','production'
    end
  end
end