Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×In my node project's bitbucket-pipelines.yml i am using docker build for the image. That image is then pushed to my container registry. The thing is, the docker build step is taking to long, its consuming to much build minutes compared to my local machine when building the image.
I would just like to know if there is a way to make the step faster in bitbucket pipelines like possible caching of docker build process, maybe?
Thank you in advance :D
You can increase the build time using the --cache-from feature, see an example:
pipelines:
default:
- step:
services:
- docker
script:
- export IMAGE_NAME=your-docker-hub/your-repo:$BITBUCKET_BRANCH
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- docker pull $IMAGE_NAME || true
- docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME .
- docker push $IMAGE_NAME
Avoid using the pipeline docker cache, only wastes time... :)
Thanks for this!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A little late but why is Bitbucket pipelines docker cache a waste of time? Haven't done enough testing but my instinct is that you are right.
For one pipe, it is not even using any build cache (which works locally).
How does `docker build --cache-from $IMAGE_NAME -t $IMAGE_NAME .` work though? Where is the cached stored? I assume it re-downloads the image each time and uses that as cache (which probably still saves a lot of time).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I second this. It seems like there is a missed opportunity to make the build process faster. Downloading the image is the step taking too long (I am just downloading node:8.2.1). Maybe bitbucket can add the TLS versions of node to their list of available images so it doesn't have to download them every time?
Definitely 10 minute build times can be a bit of a problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
did you find a solution? i 'm experienced the same issue :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
same problem here. I chewed up 50 minutes and never even got to npm install..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.
Register Now
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.