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

Caching PHP Composer Install At Pipeline

achicoria June 8, 2020

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
Atlassian Team members are employees working across the company in a wide variety of roles.
July 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
AUG Leaders

Atlassian Community Events