Edit CI/CD

This commit is contained in:
Mathieu Lagace
2019-08-04 17:40:34 -04:00
parent 54d57c7b13
commit 76c60d512f
2 changed files with 33 additions and 36 deletions

View File

@@ -1,43 +1,38 @@
image: php:7.2
image: registry.gitlab.com/thegamecraft/c-cms:latest
cache:
paths:
- vendor/
services:
- mysql:5.7
before_script:
- apt-get update -qq && apt-get install -y -qq sshpass
- apt-get install zip unzip
- apt-get install git -yqq
- sshpass -V
variables:
MYSQL_DATABASE: homestead
MYSQL_ROOT_PASSWORD: secret
DB_HOST: mysql
DB_USERNAME: root
build_stage:
stage: build
stages:
- test
- deploy
unit_test:
stage: test
script:
- curl -sS https://getcomposer.org/installer | php
- php composer.phar install
- mv composer.phar /usr/local/bin/composer
- chmod -R 777 storage
- chmod -R 777 bootstrap
- composer update
- cp .env.example .env
- composer install
- php artisan key:generate
deploy_697:
deploy_production:
stage: deploy
only:
- master
environment:
name: C697
script:
- export SSHPASS=$USER_PASS
- sshpass -e scp -o stricthostkeychecking=no -r . admin@54.39.97.124:/var/www/website/C697
- sshpass -e ssh -t admin@54.39.97.124 "cd /var/www/website/C697 && php artisan migrate"
- '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'
deploy_736:
stage: deploy
only:
- master
- ~/.composer/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA"
environment:
name: C736
script:
- export SSHPASS=$USER_PASS
- sshpass -e scp -o stricthostkeychecking=no -r . admin@54.39.97.124:/var/www/website/C736
- sshpass -e ssh -t admin@54.39.97.124 "cd /var/www/website/C736 && php artisan migrate"
name: production
url: http://dev.exvps.ca
when: manual
only:
- master

View File

@@ -5,14 +5,16 @@ FROM php:7.2
RUN apt-get update
# Install PHP and composer dependencies
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev autoconf libc-dev pkg-config
# Clear out the local repository of retrieved package files
RUN apt-get clean
# Install needed extensions
# Here you can install any other extension that you need during the test and deployment process
RUN docker-php-ext-install mcrypt pdo_mysql zip
RUN docker-php-ext-install pdo_mysql zip
RUN pecl install mcrypt-1.0.1
# Install Composer
RUN curl --silent --show-error https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer