【发布时间】:2016-12-25 18:23:50
【问题描述】:
我有一个如下所示的 Makefile:
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
我的 docker-compose 看起来像这样:
services:
foo:
container_name: foo${DOCKER_ENV}
image: foo:latest
bar:
container_name: bar${DOCKER_ENV}
image: bar:latest
当我尝试运行make dev 和make test 时,后者会使用新名称(“-test”)重新构建开发容器,而不是创建一整套单独的容器——这正是我想要的.
如何保持开发环境运行并定期启动测试环境? (我们将在某个时候在 CI 上执行此操作,但我希望开发人员能够在本地运行所有测试。)
【问题讨论】:
标签: testing docker integration-testing docker-compose