K
K
Kirill Djonua2016-10-06 14:13:15
Software Deployment
Kirill Djonua, 2016-10-06 14:13:15

Docker and gitlab-ci: a strategy?

There are several microservice applications.
Sample docker-compose.yml for each microservice:

version: "2"
services:
    memcached:
        image: memcached:latest
        container_name: servMemcached
        restart: always
        ports:
            - "11211:11211"
    mariadb:
        image: mariadb:latest
        container_name: servMariadb
        restart: always
        ports:
            - "3306:3306"
        volumes:
            - ./mariadb/data:/var/lib/mysql
        env_file: ./mariadb/env
    php-fpm:
        build: ./php
        container_name: servPhp
        restart: always
        volumes:
            - ./www:/var/www/html
        links:
            - mariadb
            - memcached
        depends_on:
            - mariadb
            - memcached
    nginx:
        image: nginx:latest
        container_name: servNginx
        restart: always
        ports:
            - "8080:80"
        volumes:
            - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf
        volumes_from:
            - php-fpm
        links:
            - php-fpm
        depends_on:
            - php-fpm
    composer:
        build: ./composer
        container_name: servComposer
        command: install
        volumes:
            - ./www:/app
            - ~/.ssh:/root/.ssh
        depends_on:
            - php-fpm

What I want:
When a new tag is pushed to a branch, for example release, gitlab-ci is started. It must build the service into an image, apply the necessary migrations (yii2 application), test the application, etc. and push to local docker registry. The purpose of the registry is not to build any images in production, but to run ready-made ones.
Questions:
  1. The servComposer , servNginx , servMariadb , servMemcached containers are essentially not part of the main service - when a new tag is created, only the application code is updated, not the containers described above. Those. there is no point in pushing them every time with a new CI build? Move the creation of such containers to a separate repository? Then how to test an application without, for example, a database container?
  2. If I understand, you need to push one image in the docker registry - a ready-made application build. But if the service is multi-container, with settings in docoker-compose.yml - how should the build of such an application look like?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-03-16
@blasterdick

Good day, comrade.
Tell me, did you manage to answer the questions posed to you?
As a result, it turned out (if it turned out) to realize the desired?
I have a similar situation , containers in kubernetes on Google Container Engine, there is also a docker registry.
Thanks in advance.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question