相关疑难解决方法(0)

如何在BitBucket管道上为apt-get启用/设置依赖缓存

我在我的bitbucket-pipelines.yml文件中使用以下代码远程deply代码到登台服务器.

image: php:7.1.1

pipelines:
  default:
    - step:
        script:
          # install ssh
          - apt-get update && apt-get install -y openssh-client
          # get the latest code
          - ssh user@domain.com -F ~/.ssh/config "cd /path/to/code && git pull"
          # update composer
          - ssh user@domain.com -F ~/.ssh/config "cd /path/to/code && composer update --no-scripts"
          # optimise files
          - ssh user@domain.com -F ~/.ssh/config "cd /path/to/code && php artisan optimize"
Run Code Online (Sandbox Code Playgroud)

这一切都有效,除了每次运行管道时,都会下载并安装ssh客户端(为构建时间增加约30秒).有没有办法可以缓存这一步?

我怎样才能缓存这个apt-get步骤?

例如,像这样的工作(或者需要进行哪些更改才能完成以下工作):

pipelines:
  default:
    - step:
        caches:
          - aptget
        script:
          - apt-get update …
Run Code Online (Sandbox Code Playgroud)

bitbucket bitbucket-pipelines

12
推荐指数
2
解决办法
2992
查看次数

标签 统计

bitbucket ×1

bitbucket-pipelines ×1