Last active
September 27, 2022 09:26
-
-
Save finoghentov/256d7b4cb6ced17484ea15668656eced to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: lorisleiva/laravel-docker:latest | |
.generate_env: &generate_env | | |
echo "APP_NAME=$APP_NAME" >> .env | |
echo "APP_ENV=PRODUCTION" >> .env | |
echo "APP_DEBUG=false" >> .env | |
echo "APP_URL=$APP_URL" >> .env | |
echo "APP_KEY=" >> .env | |
echo "DB_CONNECTION=mysql" >> .env | |
echo "DB_HOST=$DB_HOST" >> .env | |
echo "DB_PORT=$DB_PORT" >> .env | |
echo "DB_DATABASE=$DB_DATABASE" >> .env | |
echo "DB_USERNAME=$DB_USERNAME" >> .env | |
echo "DB_PASSWORD=$DB_PASSWORD" >> .env | |
echo "TELEGRAM_BOT_TOKEN=$TELEGRAM_BOT_TOKEN" >> .env | |
echo "TELEGRAM_WEBHOOK_URL=$APP_URL" >> .env | |
composer: | |
stage: build | |
script: | |
- *generate_env | |
- composer install --prefer-dist --no-ansi --no-interaction --no-progress --no-scripts | |
- php artisan key:generate | |
tags: | |
- executor-docker | |
artifacts: | |
expire_in: 10 mins | |
paths: | |
- vendor/ | |
- .env | |
phpunit: | |
stage: test | |
dependencies: | |
- composer | |
tags: | |
- executor-docker | |
script: | |
- phpunit --coverage-text --colors=never | |
.init_ssh: &init_ssh | | |
eval $(ssh-agent -s) | |
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null | |
mkdir -p ~/.ssh | |
chmod 700 ~/.ssh | |
[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config | |
.change_file_permissions: &change_file_permissions | | |
find . -type f -not -path "./vendor/*" -exec chmod 664 {} \; | |
find . -type d -not -path "./vendor/*" -exec chmod 775 {} \; | |
staging: | |
stage: deploy | |
script: | |
- *init_ssh | |
- php artisan deploy ####.ru -s upload | |
- *change_file_permissions | |
- php artisan telegram:webhook --setup | |
environment: | |
name: staging | |
url: ####.ru | |
tags: | |
- executor-docker | |
only: | |
- master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment