docker workout - using docker and GitLab in running projects

Martin Jainta

@mjainta

@mjainta

Projects

microservice

architecture

traditional

architecture

Challenges

Cross dependencies

docker

Single button deployment

docker

GitLab provides service called dind

BUT! No docker-compose built-in!

Custom-Image for docker-compose

Registry for passing images through stages

GitLab provides a docker registry

FROM jonaskello/docker-and-compose:17.03.0-1.11.2

RUN apk add --update make

custom image for docker-compose

image: registry.gitlab.com/tradebyte/build-image:latest
services:
  - docker:dind

stages:
  - build
  - test

before_script:
  - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY

build:
  stage: build
  script:
    - docker-compose build py
    - docker-compose push py
    - docker images

lint:
  stage: test
  script:
    - docker-compose pull py
    - docker images
    - make lint

passing image via gitlab registry

cross dependencies

GitLab provides Secret Keys in CI settings

GitLab provides Deploy-Keys to read a repository

Configure Deploy-Key in dependency

Configure Secrets in dependent project(s) 

configure deploy-key in dependency

configure secrets in dependent projects

Single button deployment

Again Secrets in GitLab CI

Own repository for deployment, checked out on live

Our basic workflow with gitlab ci

$ git push origin feature/dvocc17

...

Thanks for listening

want more?

docker workout -

By Martin Jainta

docker workout -

  • 27