October 6, 2019

CICD with Bitbucket Pipelines

I have created a new repo on bitbucket for the build image. This build image bundeles the os preparations as well as the pip install requirements into the image. When using this image in the Django app docker Dockfile, then the app build time reduces from 2min down to 30sec. The build image lives in its own repo https://hansdereber@bitbucket.org/hansdereber/djangodockerbuildimage.git I have created a automated build action in Docker-Hub that builds this image after each commit and puts it into the Docker-Hub registry where it can be accessed under hansdereber/djangodockerbuildimage:latest

I have created a new docker-compose file in the root of the preoject for the ci pipeline. This was necessary because Bitbucket would not allow the mounting of volumes. Since this is not necessary, nor desired for a build pipeline, I have removed the persistent volumes in this ci.yaml.

The Bitbucket pipeline is defined in the bitbucket-pipelines.yaml file.

image: docker/compose:1.25.0-rc2-alpine

  docker: true

    - step:
          - docker-compose -f ci.yml run django pytest

For the build image of the pipeline I use the docker-compose image since this comes prepared with docker-compose and I can use the script bit without any additional steps.