You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I have setup custom composer cache and its working fine and it looks something like this.
definitions:
services:
docker:
memory: 3072
caches:
sonar: ~/.sonar/cache
composer-custom: /composer/cache
and my build step looks something like this
- step: &build-api-docker-test-image
name: Build API docker test image
services:
- docker
caches:
- composer-custom
- docker
script:
- export DOCKER_BUILDKIT=1
- export IMAGE_TAG=$BITBUCKET_COMMIT
- export API_IMAGE_NAME=$API_DOCKER_IMAGE_NAME:latest
- docker build --file .docker/test/Dockerfile -t $API_IMAGE_NAME --build-arg BITBUCKET_KEY=${BITBUCKET_USERNAME} --build-arg BITBUCKET_SECRET=${BITBUCKET_READ_ACCESS_SECRET} .
- docker save --output tmp-api-image.test.docker $API_DOCKER_IMAGE_NAME
artifacts:
- tmp-api-image.test.docker
now when i try and run pipeline composer custom is always not found. because my composer install is creating files in my container. I am unable to use mount either due to restrictions.
Hello Naveed,
Thank you for reaching out to Atlassian Community!
As you mentioned, since you are doing the composer install inside your docker build command, the composer dependencies are being downloaded to a layer of docker build, and not to the pipelines build container, so this is the reason why the custom cache is not finding the composer files in the path
~/.sonar/cache
If you were downloading the dependencies outside of the docker build, the cache should work as usual.
That said, I see you have also configured the cache for docker. This should cache the docker layers (a layer is generated for every command in the Dockerfile) that have not changed since the last build, so the layers where you are installing the composer dependencies in your docker build should be cached as part of the docker cache.
Hope that helps!
Thank you, @Naveed Zahoor !
Patrik S
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.