【问题标题】:How to run bitbucket pipeline to deploy php based app on nanobox如何运行 bitbucket 管道在 nanobox 上部署基于 php 的应用程序
【发布时间】:2019-10-10 08:38:13
【问题描述】:

我正在尝试为旨在部署在 nanobox.io 上的基于 php (Laravel-Lumen) 的应用程序设置 bitbucket 管道。我希望此管道在提交代码更改后立即部署我的应用程序。

我的 bitbucket-pipelines.yml 看起来像这样

image: php:7.1.29

pipelines:
  branches:
    staging:
    - step:
        name: Publish to staging version
        deployment: staging
        caches:
          - composer
        script:
          - apt-get update && apt-get install -y unzip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install
#          - vendor/bin/phpunit
          - bash -c "$(curl -fsSL https://s3.amazonaws.com/tools.nanobox.io/bootstrap/ci.sh)"
          - nanobox deploy

这会出现以下错误

+ nanobox deploy
Failed to validate provider - missing docker - exec: "docker": executable file not found in $PATH
Using nanobox with native requires tools that appear to not be available on your system.
docker
View these requirements at docs.nanobox.io/install

然后我关注this page 并将倒数第二行更改为如下所示

sudo bash -c "$(curl -fsSL https://s3.amazonaws.com/tools.nanobox.io/bootstrap/ci.sh)"

完成后,我收到以下错误

+ sudo bash -c "$(curl -fsSL https://s3.amazonaws.com/tools.nanobox.io/bootstrap/ci.sh)"
bash: sudo: command not found

我在这里没有技巧,我也没有这方面的经验。非常感谢任何帮助。

【问题讨论】:

    标签: docker continuous-integration continuous-deployment bitbucket-pipelines nanoboxio


    【解决方案1】:

    首先,您不能在管道中使用sudo,但这可能与这里无关。问题是 nanobox cli 不想执行未安装的 docker。您应该为您的步骤启用 docker 服务。

    image: php:7.1.29
    
    pipelines:
      branches:
        staging:
          - step:
              name: Publish to staging version
              deployment: staging
    
              # Enable docker service
              services:
                - docker
              caches:
                - composer
              script:
                - docker version
    

    您可能也不想查看 Pipelines 文档:Run Docker commands in Bitbucket Pipelines

    【讨论】:

      猜你喜欢
      • 2017-06-14
      • 2020-11-03
      • 1970-01-01
      • 2020-11-20
      • 2020-06-09
      • 2017-10-17
      • 1970-01-01
      • 2017-11-03
      • 2011-05-17
      相关资源
      最近更新 更多