Installing dependencies in your Pipelines build

Bitbucket Pipelines runs your builds in a Docker container that defines the build environment. Dependencies needed for your build need to either be manually installed or provided in the Docker image itself.





Installing dependencies in the build script

The easiest way to get your dependencies available for your build is to install them in 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, installing some dependencies using apt-get:

image: maven:3.3.9
    - step:
          - apt-get update && apt-get install -y imagemagick libjmagick6-java  # install deps
          - mvn package      # build the Java app

Providing dependencies in your own Docker image

This is described on Using Docker images as build environments, under Create New Environments.

Running dependencies as services (coming soon)

If your dependencies can be run as processes in their own Docker container, it will soon be possible to run these as additional Docker containers in your build (issue #12757). This will be the recommended approach for running databases, external caches, etc.

Until this is supported, you will need to use one of the two methods above.



Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport