How to run bitbucket pipeline to deploy php based app on nanobox

845 Views Asked by At

I am trying to setup bitbucket pipeline for a php based (Laravel-Lumen) app intended to be deployed on nanobox.io. I want this pipeline to deploy my app as soon as code changes are committed.

My bitbucket-pipelines.yml looks like this

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

This gives Following error

+ 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

I then followed this page and changed second last line to look like this

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

when done that, I am getting following error

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

I ran out of tricks here, also I don't have experience in this area. Any help is very much appreciated.

1

There are 1 best solutions below

0
On

First, you can't use sudo in pipelines, but that's probably not relevant here. The issue is that nanobox cli wan't to execute docker, which isn't installed. You should enable the docker service for your step.

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

You might wan't to have a look at Pipelines docs as well: Run Docker commands in Bitbucket Pipelines