Skip to content

Instantly share code, notes, and snippets.

@jamesfacts
Last active June 8, 2020 13:26
Show Gist options
  • Save jamesfacts/c850c615bd0eb4d84e79596b6ef46023 to your computer and use it in GitHub Desktop.
Save jamesfacts/c850c615bd0eb4d84e79596b6ef46023 to your computer and use it in GitHub Desktop.
image: php:7.2-cli
before_script:
# Updates
- curl -sL https://deb.nodesource.com/setup_10.x | bash
- curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
- echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
- apt-get update
- apt-get -y install yarn libpcre3-dev zlib1g-dev libbz2-dev libpng-dev libjpeg-dev nodejs git zip unzip curl rsync mysql-client
- docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr
- docker-php-ext-install zip bz2 gd mysqli pdo pdo_mysql
# Composer
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php -r "copy('https://composer.github.io/installer.sig', 'composer-setup.sig');"
- php -r "if (hash_file('SHA384', 'composer-setup.php') === trim(file_get_contents('composer-setup.sig'))) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- php composer-setup.php --install-dir=/usr/local/bin --filename=composer
- php -r "unlink('composer-setup.php');"
- php -r "unlink('composer-setup.sig');"
# Install Node / Yarn
- npm -g install yarn
- npm rebuild node-sass --force
# SSH
- "which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )"
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# Allow deploy script to execute
- chmod +x ./bin/deploy
deploy_development:
only:
- development
environment:
name: development
url: http://[your-live-install-here].wpengine.com
script: ./bin/deploy
deploy_staging:
only:
- staging
environment:
name: staging
url: http://[your-staging-install-here].wpengine.com
script: ./bin/deploy
deploy_production:
only:
- master
environment:
name: production
url: http://[your-dev-install-here].wpengine.com
when: manual
script: ./bin/deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment