Specify dependencies in your Pipelines build
Bitbucket Pipelines runs your builds in a Docker container that provides the build environment. There are a few ways you can specify any dependencies that your build needs in that container – we recommend running dependencies as services in their own containers.
- Caching dependencies
- Configure bitbucket-pipelines.yml
- Use Docker images as build environments
- Use services and databases in Bitbucket Pipelines
Run dependencies as services (recommended)
If your dependencies can be run as services in their own Docker containers, you should define them as additional services in the 'definitions' section of the bitbucket-pipelines.yml file. These services can then be referenced in the configuration for a particular pipeline. This is the recommended approach for running databases, external caches, etc. See Use services and databases in Bitbucket Pipelines for details.
Install dependencies using the build script
An easy way to make dependencies available to your build is to install them using the build script in your bitbucket-pipelines.yml file. The exact method of installing dependencies will depend on the Docker image you're using for your build.
For Docker images based on Debian or Ubuntu, you can use apt-get to install packages.
Below is an example for the Maven 3.3.9 Docker image, which is based on Debian, showing how to install dependencies using apt-get:
image: maven:3.3.9 pipelines: default: - step: script: # install deps - apt-get update && apt-get install -y imagemagick libjmagick6-java # build the Java app - mvn package
You can check your bitbucket-pipelines.yml file with our online validator.
Provide dependencies in your own Docker image
This is described on Using Docker images as build environments, under Create new environments.