Created
March 12, 2020 13:43
-
-
Save victorlapshev/900adf46d3b1c195239cc17728534167 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
| {{ $php_version := "7.3" }} | |
| {{ $container_workdir := "/usr/src/app" }} | |
| {{ $base_image_name := "fpm-base" }} | |
| {{ $builder_image_name := "builder" }} | |
| {{ $app_image_name := "app-fpm" }} | |
| configVersion: 1 | |
| project: symfony-api | |
| --- | |
| # base image | |
| image: {{ $base_image_name }} | |
| from: php:{{ $php_version }}-fpm | |
| ansible: | |
| beforeInstall: | |
| - name: Install a list of packages | |
| apt: | |
| name: "{{`{{ packages }}`}}" | |
| update_cache: yes | |
| vars: | |
| packages: | |
| - build-essential | |
| - libfreetype6-dev | |
| - libjpeg62-turbo-dev | |
| - libpng-dev | |
| - libxml2-dev | |
| - zlib1g-dev | |
| - libzip-dev | |
| - imagemagick | |
| - libmagickwand-dev | |
| - librabbitmq-dev | |
| - name: "Install php packages" | |
| raw: | | |
| pecl install -o -f amqp redis imagick && docker-php-ext-enable redis imagick && \ | |
| docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && \ | |
| docker-php-ext-install -j$(nproc) iconv mysqli pdo pdo_mysql dom gd simplexml exif fileinfo mbstring zip pcntl \ | |
| opcache intl | |
| - name: Enable amqp | |
| raw: echo "extension = amqp.so \n" > /usr/local/etc/php/conf.d/amqp.ini | |
| docker: | |
| WORKDIR: {{ $container_workdir }} | |
| --- | |
| # builder image | |
| image: {{ $builder_image_name }} | |
| fromImage: {{ $base_image_name }} | |
| ansible: | |
| beforeInstall: | |
| - name: Install composer | |
| raw: curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
| - name: Install prestissimo | |
| composer: | |
| command: require | |
| global_command: yes | |
| arguments: hirak/prestissimo | |
| --- | |
| artifact: build | |
| fromImage: {{ $builder_image_name }} | |
| git: | |
| - add: '/composer.json' | |
| to: '{{ $container_workdir }}/composer.json' | |
| - add: '/composer.lock' | |
| to: '{{ $container_workdir }}/composer.lock' | |
| stageDependencies: | |
| install: | |
| - "" | |
| - add: '/symfony.lock' | |
| to: '{{ $container_workdir }}/symfony.lock' | |
| - add: '/src' | |
| to: '{{ $container_workdir }}/src' | |
| stageDependencies: | |
| install: | |
| - "" | |
| ansible: | |
| install: | |
| - name: Composer install | |
| composer: | |
| command: install | |
| no_scripts: yes | |
| no_dev: yes | |
| working_dir: {{ $container_workdir }} | |
| --- | |
| image: {{ $app_image_name }} | |
| fromImage: {{ $base_image_name }} | |
| git: | |
| - add: '/config' | |
| to: '{{ $container_workdir }}/config' | |
| owner: www-data | |
| group: www-data | |
| - add: '/public' | |
| to: '{{ $container_workdir }}/public' | |
| owner: www-data | |
| group: www-data | |
| - add: '/src' | |
| to: '{{ $container_workdir }}/src' | |
| owner: www-data | |
| group: www-data | |
| - add: '/var' | |
| to: '{{ $container_workdir }}/var' | |
| owner: www-data | |
| group: www-data | |
| import: | |
| - artifact: build | |
| add: {{ $container_workdir }}/vendor | |
| before: setup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment