'How to use the image between steps in bitbucket-pipelines
I would be grateful if someone could help me with setting up bitbucket-pipeline for my php env. What I'm trying to succeed is:
- Build image in the first step
- In the second step run some QA stuff like unit test, code sniffer etc.
- Deploy to preprod envirement
Currently I'm stuck with re-using image from the first step. This is how my bitbucket-pipelines.yml looks like:
pipelines:
branches:
develop:
- step:
name: Build docker image
caches:
- composer
script:
- apt-get update && apt-get install -y unzip
- docker-php-ext-install mysqli pdo_mysql json sockets
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- parallel:
- step:
caches:
- composer
name: Unit tests
script:
- vendor/bin/phpunit
- step:
caches:
- composer
name: Code sniffer
script:
- composer phpcs:all
- step:
name: Deploy to preprod
script:
- echo "Deployment"
What I get here is:
bash: vendor/bin/phpunit: No such file or directory - from "Unit tests" step
and bash: composer: command not found - from "Code sniffer" step
I already tried to set docker/composer to cache, save image in the first step and import it in the second, but still not working.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
