How not to run docker-compose
in .gitlab-ci.yml
?
Official docker-compose
docs recommend this installer:
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
Curl is not available in docker:lastest
image, so let's use wget
.
my_integration_test:
stage: test
image: docker:latest
before_script:
- wget https://github.com/docker/compose/releases/download/1.22.0/run.sh -O /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
script:
- docker-compose -f docker-compose.tests.yml run --rm tests pytest tests/integration_test.py
.FileNotFoundError: [Errno 2] No such file or directory: './docker-compose.api.test.yml'
ERROR: Job failed: exit code 1
It turns out that the installer mounts current directory as volume, hiding our source code!
Just install via pip
:
my_integration_test:
stage: test
image: docker:latest
before_script:
- apk add --no-cache py-pip
- pip install docker-compose
script:
- docker-compose -f docker-compose.tests.yml run --rm tests pytest tests/integration_test.py