Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to configure caching for custom base image Edited

Hi,

I've a Bitbucket Pipeline that is using an custom docker image as a base. Pulling it from the ECR. Also, I'm using this image to build dockerized Golang apps in the first step with make commands. I want to cache Golang modules that is being downloaded in the make build process. But when I read the examples, People are using golang base images to make caching work. How can I activate caching while using base image other than Go image itself? Related parts of my pipeline is on below. I defined it like this but it doesn't work.

Thank you.

image: 
name: <ECR Image>
aws:
access-key: $AWS_ACCESS_KEY_ID
secret-key: $AWS_SECRET_ACCESS_KEY

definitions:
caches:
go: $GOPATH/pkg

pipelines:
- step
:
name: "Image Build & Push"
services:
    -docker
caches:
-go
script:
- export ENVIRONMENT=beta
- echo "Environment is ${ENVIRONMENT}"
- export DOCKER_IMAGE_BUILDER="${BITBUCKET_REPO_SLUG}:builder"
- make clean
- make build BUILD_VER=${BITBUCKET_TAG}.${BITBUCKET_BUILD_NUMBER} \ APP_NAME=${BITBUCKET_REPO_SLUG} \
DOCKER_IMAGE_BUILDER=${DOCKER_IMAGE_BUILDER}
- make test

 

1 answer

0 votes

Hi! 

Will it help the next idea of caching? 

...
- step
caches:
- node-custom
script:
- if [ ! -d "node_modules" ]; then npm install; fi
...

definitions:
caches:
node-custom: public/node_modules

 https://community.atlassian.com/t5/Bitbucket-questions/Pipelines-cache-custom-node-modules-folder/qaq-p/771598

 

Because you just want to cache the dependencies. \

If I understood incorrectly, feel free to provide a more info please

Cheers,

Gonchik Tsymzhitov

Hi Gonchik, thank you for your response, yes I want to cache dependencies. But as you can see, I'm using docker inside another Docker container to build another image. So go or node path may not be able to help in this case, or I couldn't make it work. In theory, is it possible to apply path based caching in my case?

 

Best Regards.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket Pipelines

What We Learned When We Researched Open Source Vulnerabilities in 7 Popular Coding Languages

...hey are a part of us, shaping how we interact with the world around us. The same holds true for programming languages when we think about how different kinds of vulnerabilities raise their heads in t...

1,328 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you