jeudi 18 août 2016

Running docker integration test containers while dev containers running

I have a Makefile that looks like this:

dev:
    docker-compose up -d --build

test:
    DOCKER_ENV="-test" docker-compose up -d --build
    // run some integration tests on the containers then
    // shut them down (and let ephemeral database disappear)
    DOCKER_ENV="-test" docker-compose down -v

And my docker-compose looks like this:

services:
  foo:
    container_name: foo${DOCKER_ENV}
    image: foo:latest
  bar:
    container_name: bar${DOCKER_ENV}
    image: bar:latest

When I try to run make dev and then make test the latter causes the dev containers to be rebuilt with the new name ("-test") rather than create an entire separate set of containers—which is what I want.

How can I keep the dev environment running and periodically spin up the test environment? (We'll do this on CI at some point, but I want developers to be able to locally run all the tests.)

Aucun commentaire:

Enregistrer un commentaire