Configure bitbucket-pipeline.yml to use a DockerFile from repository to build image when running a pipeline

  bitbucket, bitbucket-pipelines, docker

I am new on creating pipelines on bitbucket to automate building a specific branch after merge.
The project is written in C++ and has the following structure:

PROJECT FOLDER
    - .devcontainer/
        - devcontainer.json
    - bin/
    - doc/
    - lib/
    - src/
        - CMakeLists.txt
        - ...
    - CMakeLists.txt
    - clean.sh
    - compile.sh
    - configure.sh
    - DockerFile
    - bitbucket-pipelines.yml

We created a DockerFile with all the settings required to build the project. Is there any way I can reference the docker image on bitbucket-pipeline.yml to the DockerFile from the repository?

I have been able to upload the docker image on my docker hub and use it with my credentials by defining:

image:
  name: <dockerhubname>/<dockername>
  username: $DOCKER_HUB_USERNAME
  password: $DOCKER_HUB_PASSWORD
  email: $DOCKER_HUB_EMAIL

but I am not sure how to do so bitbucket takes the DockerFile from the repository and uses it to build the image, and if by doing it like this, the build time will increase.

Thanks in advance!

Source: Docker Questions

LEAVE A COMMENT