Get started with Bitbucket Cloud
New to Bitbucket Cloud? Check out our get started guides for new users.
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.
See also:
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.
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:
1
2
3
4
5
6
7
8
9
10
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
If you need to use the same dependencies in multiple steps, we recommend caching them to save download time.
You can check your bitbucket-pipelines.yml file with our online validator.
This is described on Using Docker images as build environments, under Create new environments.
Was this helpful?