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
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.