2023-04-17 13:53:19 +02:00
|
|
|
variables:
|
|
|
|
- &volumes
|
2023-04-17 13:57:19 +02:00
|
|
|
- node16_cache:/root/.npm
|
2023-04-17 13:53:19 +02:00
|
|
|
|
2022-12-28 12:59:13 +01:00
|
|
|
pipeline:
|
2023-01-15 15:58:15 +01:00
|
|
|
db-wait:
|
2023-01-01 11:56:28 +01:00
|
|
|
image: gitnet.fr/deblan/timeout:latest
|
|
|
|
commands:
|
2023-01-01 12:16:26 +01:00
|
|
|
- /bin/timeout -t 30 -v -c 'while true; do nc -z -v db 3306 2>&1 | grep succeeded && exit 0; sleep 0.5; done'
|
2023-01-01 11:56:28 +01:00
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
db-create:
|
2022-12-28 16:11:40 +01:00
|
|
|
image: mariadb:10.3
|
|
|
|
secrets: [mysqldump]
|
|
|
|
commands:
|
|
|
|
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
|
|
|
- eval "$MYSQLDUMP" | mysql -hdb -uroot -proot app
|
2022-12-28 17:40:10 +01:00
|
|
|
when:
|
|
|
|
branch: [master, master-*, develop, develop-*]
|
2022-12-28 16:11:40 +01:00
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
app-config:
|
2022-12-28 16:11:40 +01:00
|
|
|
image: deblan/php:8.1
|
|
|
|
commands:
|
|
|
|
- echo APP_ENV=prod >> .env.local
|
|
|
|
- echo APP_SECRET=$(openssl rand -hex 32) >> .env.local
|
|
|
|
- echo DATABASE_URL=mysql://root:root@db/app >> .env.local
|
2022-12-28 17:40:10 +01:00
|
|
|
when:
|
|
|
|
branch: [master, master-*, develop, develop-*]
|
2022-12-28 16:11:40 +01:00
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
php-composer:
|
2022-12-28 16:11:40 +01:00
|
|
|
image: deblan/php:8.1
|
|
|
|
commands:
|
|
|
|
- apt-get update && apt-get -y install git
|
|
|
|
- composer install --no-scripts
|
2022-12-28 15:24:57 +01:00
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
db-migrate:
|
2022-12-28 12:59:13 +01:00
|
|
|
image: deblan/php:8.1
|
2022-12-28 16:11:40 +01:00
|
|
|
environment:
|
|
|
|
- PHP=php
|
2022-12-28 12:59:13 +01:00
|
|
|
commands:
|
2022-12-28 16:11:40 +01:00
|
|
|
- ./bin/doctrine-migrate
|
2022-12-28 17:40:10 +01:00
|
|
|
when:
|
2022-12-30 17:37:10 +01:00
|
|
|
branch: [master, master-*, develop, develop-*, feature/*]
|
2022-12-28 15:24:57 +01:00
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
app-jsroutes:
|
2022-12-28 16:11:40 +01:00
|
|
|
image: deblan/php:8.1
|
|
|
|
commands:
|
|
|
|
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
|
2022-12-28 17:40:10 +01:00
|
|
|
when:
|
2022-12-30 17:37:10 +01:00
|
|
|
branch: [master, master-*, develop, develop-*, feature/*]
|
2022-12-28 16:11:40 +01:00
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
node-build:
|
2023-01-22 00:59:28 +01:00
|
|
|
image: node:16-alpine
|
2023-01-15 17:28:12 +01:00
|
|
|
environment:
|
|
|
|
- CPU_COUNT=3
|
2023-04-17 13:53:19 +02:00
|
|
|
volumes: *volumes
|
2022-12-28 16:11:40 +01:00
|
|
|
commands:
|
2023-01-22 00:57:46 +01:00
|
|
|
- apk add --no-cache git
|
2022-12-28 16:11:40 +01:00
|
|
|
- npm install -g svg2ttf ttf2eot ttf2woff2
|
|
|
|
- svg2ttf assets/fonts/deblan/src/deblan-icon.svg assets/fonts/deblan/deblan-icon.ttf
|
|
|
|
- cat assets/fonts/deblan/deblan-icon.ttf | ttf2woff2 > assets/fonts/deblan/deblan-icon.woff2
|
|
|
|
- ttf2eot assets/fonts/deblan/deblan-icon.ttf assets/fonts/deblan/deblan-icon.eot
|
|
|
|
- yarn
|
2022-12-28 17:40:10 +01:00
|
|
|
- test -f public/js/fos_js_routes.json || echo "{}" > public/js/fos_js_routes.json
|
2022-12-28 16:11:40 +01:00
|
|
|
- npm run build
|
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
security-check:
|
2023-01-02 11:18:15 +01:00
|
|
|
image: gitnet.fr/deblan/osv-detector:v0.9
|
2023-01-01 13:45:16 +01:00
|
|
|
commands:
|
|
|
|
- osv-detector composer.lock yarn.lock
|
|
|
|
failure: ignore
|
|
|
|
|
2023-01-15 15:58:15 +01:00
|
|
|
app-deploy:
|
2022-12-28 16:11:40 +01:00
|
|
|
image: deblan/php:8.1
|
|
|
|
secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory]
|
|
|
|
commands:
|
2022-12-28 17:04:13 +01:00
|
|
|
- apt-get update && apt-get -y install rsync openssh-client
|
2022-12-28 16:11:40 +01:00
|
|
|
- mkdir "$HOME/.ssh"
|
|
|
|
- echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519"
|
|
|
|
- chmod 700 "$HOME/.ssh"
|
|
|
|
- chmod 600 "$HOME/.ssh/id_ed25519"
|
|
|
|
- composer global require andres-montanez/magallanes
|
|
|
|
- cp .mage.yml.dist .mage.yml
|
|
|
|
- sed -i "s/ssh_user/$SSH_USER/g" .mage.yml
|
|
|
|
- sed -i "s/ssh_host/$SSH_HOST/g" .mage.yml
|
|
|
|
- sed -i "s#app_directory#$APP_DIRECTORY#g" .mage.yml
|
|
|
|
- /root/.config/composer/vendor/bin/mage deploy "$CI_BUILD_DEPLOY_TARGET"
|
|
|
|
when:
|
2022-12-28 16:51:33 +01:00
|
|
|
event: [deployment]
|
2022-12-28 13:44:31 +01:00
|
|
|
|
2022-12-28 16:11:40 +01:00
|
|
|
services:
|
|
|
|
db:
|
|
|
|
image: mariadb:10.3
|
|
|
|
environment:
|
|
|
|
- MARIADB_ROOT_PASSWORD=root
|
2023-04-17 13:53:19 +02:00
|
|
|
|
|
|
|
volumes:
|
2023-04-17 13:57:19 +02:00
|
|
|
node16_cache:
|
2023-04-17 13:53:19 +02:00
|
|
|
temp: {}
|