Skip to content

Instantly share code, notes, and snippets.

@fernandohs1500
Last active September 8, 2019 19:23
Show Gist options
  • Save fernandohs1500/ee0d8fd99ef74fe4872fc86a8cfb5a31 to your computer and use it in GitHub Desktop.
Save fernandohs1500/ee0d8fd99ef74fe4872fc86a8cfb5a31 to your computer and use it in GitHub Desktop.
Pipeline Bitbucket - PHP + AWSElasticBeanStalk
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1.29
pipelines:
branches:
develop:
- step:
name: "Build and Test"
caches:
- composer
script:
- apt-get update && apt-get install -y unzip
- apt-get update && apt-get install software-properties-common python-software-properties -y && apt-add-repository ppa:ondrej/php && apt-get update && apt-get install python-dev zip libmcrypt-dev postgresql postgresql-contrib libgd-dev php7.1-gd php7.1-intl php7.1-xsl ext-gd -y
- apt-get -y install libjpeg-dev
- apt-get -y install libpng-dev
- docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr
- docker-php-ext-install gd
- docker-php-ext-install zip
- apt-get install -y zip
- zip -r application.zip .
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- vendor/bin/phpunit
artifacts:
- application.zip
- step:
name: "Deploy to Staging"
script:
- pipe: atlassian/aws-elasticbeanstalk-deploy:0.3.1
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION_STAGING
ENVIRONMENT_NAME: $ENVIRONMENT_NAME_STAGING
APPLICATION_NAME: $APPLICATION_NAME_STAGING
S3_BUCKET: $S3_BUCKET_STAGING
ZIP_FILE: 'application.zip'
VERSION_LABEL: 'deploy-bitbucket-$BITBUCKET_BUILD_NUMBER-multiple'
COMMAND: 'all'
DEBUG: 'true'
@fernandohs1500
Copy link
Author

The $AWS variables are set in Settings -> Pipelines -> Repository Variables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment