How to Configure Capistrano to Deploy from Local Git Repository?

后端 未结 6 2046
别跟我提以往
别跟我提以往 2021-01-30 03:25

What changes do I need to make to the deploy.rb file below to make it deploy my app from a local git repo? If I can\'t deploy from a local repo, can I have capistra

6条回答
  •  悲&欢浪女
    2021-01-30 03:50

    Capistrano 3 solution which is running for me:

      before :deploy, :deploy_from_local_repo
    
      task :deploy_from_local_repo do
        set :repo_url,  "file:///tmp/.git"
        run_locally do
          execute "tar -zcvf /tmp/repo.tgz .git"
        end
        on roles(:all) do
          upload! '/tmp/repo.tgz', '/tmp/repo.tgz'
          execute 'tar -zxvf /tmp/repo.tgz -C /tmp'
        end
      end
    

    Before deploying you are uploading a tar.gz file to the server, unzip and finally reset the :repo_url to file mode.

    Take care to remove the pervious repo:

    task :remove_repo do
      on roles(:all) do
        execute "rm -r #{repo_path}"
      end
    end
    

提交回复
热议问题