Make files

Автоматизация и унификация процессов

Задача: Установить проект

  • Подготовить файловую систему (создать папки с правами)
  • Запустить [composer install] и [yarn install]
  • Скачать и импортировать базу данных 
  • Скачать файлы 

Решение

  • Вручную
  • Автоматизированные скрипты

Make files

Makefile
default: up

up:
    docker-compose up -d --remove-orphans

down:
    docker-compose down -v --remove-orphans

restart:
    @$(MAKE) -s down
    @$(MAKE) -s up
make
make up
make down
make restart

Файл

Внутри

Запуск

Преимущества

Работает с коробки

Упрощение длинных команд

docker-compose run -T --rm node yarn --silent run eslint
make code:check

Выполнение нескольких команд

docker-compose run --rm php composer install --no-suggest
docker-compose run --rm php chmod 666 web/sites/default/settings.php
docker-compose run --rm node yarn install
make prepare

Инкапсуляция

install: 
    @$(MAKE) -s install
    @$(MAKE) -s up
    @$(MAKE) -s files\:sync
    @$(MAKE) -s db\:dump
    @$(MAKE) -s db\:import
    @$(MAKE) -s update

Унификация

[make install]    - Installs the project
[make update]     - Fetch latest code, Import database, apply updates
[make up]         - Runs all the Docker containers
[make down]       - Stops all the Docker containers and removes them
[make restart]    - Restarts the Docker containers
[make exec]       - Runs container shell. Example: `make exec php`
[make code:check] - Runs coding standard checks
[make tests:run]  - Runs tests. Example: `make tests:run acceptance`

Make files

By Sergey Korzh

Make files

  • 569