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

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

Caching PHP Composer Install At Pipeline

HI Guys.

I have a Docker tha thave a layer that execute the command php require predis, this command is taking 10 minutes).

How i can cache him at bitbucket pipeline.

I try to set cache docker but didnt work, he still executing the command.

Here is my pipe :

pipelines:
branches:
release/staging-be-v12:
- step:
name: Build and Push Docker Image to ECR
services:
- docker
caches:
- docker
image: tstrohmeier/awscli:3.6.4
script: # Modify the commands below to build your repository.
# Copy ENV Config File
- aws s3 cp s3://cartx-pipeline-config-files/staging.env ./.env
# aws login
- eval $(aws ecr get-login --region ${AWS_DEFAULT_REGION} --no-include-email | sed 's|https://||')
# set build id and deployment environment to uniquely identify your build
- export DEPLOYMENT_ENV=staging
- export BUILD_ID=$BITBUCKET_BRANCH_$BITBUCKET_COMMIT_$BITBUCKET_BUILD_NUMBER
# build docker images
- docker build -f ./Dockerfile -t ${AWS_REGISTRY_URL_STAGING}:$BUILD_ID .
# push docker image to AWS
- docker push ${AWS_REGISTRY_URL_STAGING}:$BUILD_ID

- step:
name: Deploy to ECS
image: atlassian/default-image:2
script:
# Replace the docker image name in the task definition with the newly pushed image.
- export BUILD_ID=$BITBUCKET_BRANCH_$BITBUCKET_COMMIT_$BITBUCKET_BUILD_NUMBER
- envsubst < task-definition-template.json > task-definition.json

# Update the task definition.
- pipe: atlassian/aws-ecs-deploy:1.0.0
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
CLUSTER_NAME: 'CartX-Staging'
SERVICE_NAME: 'CartX-Staging-Ecomm'
TASK_DEFINITION: 'task-definition.json'
definitions:
services:
docker:
memory: 3072

1 answer

0 votes
mkleint Atlassian Team Jul 22, 2020

not sure what your FROM docker image is, but you could create a sort of base that installs that package/tool and push it to a docker registry. Then inside pipelines only extend that image.

Suggest an answer

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

New improvements to user management in Bitbucket Cloud 👥

Hey Community! We’re willing to wager that quite a few of you not only use Bitbucket, but administer it too. Our team is excited to share that we’ll be releasing improvements throughout this month of...

3,736 views 10 16
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