gitlab.com CI docker-compose

Viewed 1364

I've dockerised my application and use docker-compose to run it locally. I'd like to use the same docker-compose commands I use locally to build and test my application on the CI runner but I can't seem to find any documentation on how?

I'm using gitlab.com and there documentation says you should just use the docker image. Only docker-compose doesn't seem to come with the standard image any more...

What's the best approach to use docker-compose with GitLab CI?

EDIT: Use case

.gitlab-ci.yml

image: docker:latest

variables:
  DOCKER_DRIVER: overlay
  WORKER_TEST_IMAGE: registry.gitlab.com/org/project/worker:$CI_COMMIT_REF_NAME
  WORKER_RELEASE_IMAGE: registry.gitlab.com/org/project/worker:latest

services:
  - postgres:9.6.3
  - docker:dind

stages:
- build
- test
- release
- deploy

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

build_worker:
  stage: build
  script:
    - docker build --pull -t $WORKER_TEST_IMAGE .
    - docker push $WORKER_TEST_IMAGE

test_worker:
  stage: test
  script:
    - docker pull $WORKER_TEST_IMAGE
    # I need a way to connect the postgres service to the image I'm 
    # trying to run. Which doesn't seem possible?
    # - docker-compose run worker dockerize -wait tcp://postgres:5432 nosetests
    - docker run $WORKER_TEST_IMAGE dockerize -wait tcp://postgres:5432 nosetests
...

I feel like Gitlab CI is making me reimplement docker-compose because they don't support it?

1 Answers
Related