Traditionally, I had been issuing
pip install docker-compose
instructions in my pipelines scripts for steps needing it, usually for integration tests.
This was convenient because it operates flawlessly with the docker binary provided by Bitbucket's docker service, and benefits from the pip cache since I am already using python images for those steps. But I'd rather work with up-to-date software, so I am looking for mechanisms to install docker-compose V2.
Ideally, the solution should
Is anyone addressing this? What's your experience?
One way to get it working is to download the latest release from github, place it in ~/.docker/cli-plugins and cache this folder.
definitions:
caches:
docker-cliplugins: ~/.docker/cli-plugins
yaml-anchors:
- &setup-docker-compose-latest-script >-
wget --no-verbose --no-clobber https://github.com/docker/compose/releases/latest/download/docker-compose-linux-x86_64 --output-document ~/.docker/cli-plugins/docker-compose
|| true
; chmod a+x ~/.docker/cli-plugins/docker-compose
&& ln --symbolic ~/.docker/cli-plugins/docker-compose /usr/local/bin/docker-compose
pipelines:
default:
- step:
services: [docker]
caches: [docker-cliplugins]
script:
- *setup-docker-compose-latest-script
- docker compose version
This needs wget --no-clobber to benefit from the cache.
Ideally this could be done in a reusable way with a pipe, just like you would with "setup" github actions. But because pipes are only mounted the clone directory and not the whole agent, here you have this yaml anchor.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With