Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CI/CD of Laravel applications on AWS ElasticBeanStalk with Bitbucket Pipelines. [phpunit, test, php] (I use this configuration in a production project)
definitions:
services:
mysql:
image: mysql:5.7
environment:
MYSQL_DATABASE: 'testing'
MYSQL_USER: 'admin'
MYSQL_PASSWORD: 'admin'
MYSQL_ROOT_PASSWORD: 'admin'
pipelines:
branches:
develop:
- step:
image: ambientum/php:7.3
caches:
- composer
script:
- composer install
- sed -i 's/DB_HOST=mysql-testing/DB_HOST=127.0.0.1/g' .env.testing
- vendor/bin/phpunit --dont-report-useless-tests --stop-on-error
services:
- mysql
staging:
- step:
name: Building
image: ambientum/php:7.3
caches:
- composer
script:
- composer install
artifacts:
- vendor/**
- step:
name: Testing
image: ambientum/php:7.3
script:
- sed -i 's/DB_HOST=mysql-testing/DB_HOST=127.0.0.1/g' .env.testing
- vendor/bin/phpunit --dont-report-useless-tests --stop-on-error
services:
- mysql
- step:
name: Compacting
image: atlassian/default-image:2
script:
- rm -rf vendor .git
- zip -r application.zip .
artifacts:
- application.zip
- step:
name: Deploying
image: ambientum/php:7.3
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
S3_BUCKET: $S3_BUCKET
APPLICATION_NAME: $APPLICATION_NAME
ENVIRONMENT_NAME: $ENVIRONMENT_NAME_STAGING
ZIP_FILE: 'application.zip'
WAIT: 'false'
master:
- step:
name: Building
image: ambientum/php:7.3
caches:
- composer
script:
- composer install
artifacts:
- vendor/**
- step:
name: Testing
image: ambientum/php:7.3
script:
- sed -i 's/DB_HOST=mysql-testing/DB_HOST=127.0.0.1/g' .env.testing
- vendor/bin/phpunit --dont-report-useless-tests --stop-on-error
services:
- mysql
- step:
name: Compacting
image: atlassian/default-image:2
script:
- rm -rf vendor .git
- zip -r application.zip .
artifacts:
- application.zip
- step:
name: Deploying
image: ambientum/php:7.3
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.5.4
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
S3_BUCKET: $S3_BUCKET
APPLICATION_NAME: $APPLICATION_NAME
ENVIRONMENT_NAME: $ENVIRONMENT_NAME_PRODUCTION
ZIP_FILE: 'application.zip'
WAIT: 'true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.