Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-20141

Specify Dockerfile location in Docker Build Image Tasks

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Duplicate
    • None
    • Docker
    • 0
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      In some larger projects I have several Dockerfiles each in their own sub-directories in order to organise them rather than putting them in the root directory.

      Using a tool such as Docker Compose, I can specify the Dockerfile location and the build context separately when building Docker images.

      This seems to be impossible in Bamboo. If I change the working sub-directory in a Build a Docker Image task to say <project-directory>/docker/php then I can't now copy files across from <project-directory> to the image I'm building using the COPY command in the Dockerfile. I can of course move the Dockerfile in question to the root <project-directory> but then I'm now limiting myself to a "one Dockerfile per project" scenario.

      Here's an example of a docker-compose.yml file where I can be flexible with build context and dockerfile locations:

      version: '3'
      
      volumes:
          logs:
              driver: local
          dbdata:
      
      services:
          php:
              build:
                  context: .
                  dockerfile: docker/php/Dockerfile
              env_file: .env
              volumes:
                  - .:/usr/src/mail-exchange
                  - logs:/var/www/logs
              links:
                  - db
          nginx:
              build:
                  context: docker/nginx/.
              ports:
                  - 80:80
              volumes:
                  - .:/var/www
              links:
                - php
      

      The benefit here is that I can organise my Dockerfiles neatly and have multiple Dockerfiles in the same project. This is essential when these days it's quite command to have large applications running in Kubernetes with serveral images (PHP or Node.js, Redis, Nginx).

      My suggested solution would be to either integrate Docker Compose with Docker related tasks as some IDEs do. Alternatively we could specify the Dockerfile location for a Docker Image Build task.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              cfbda3d3a0bf Alvin Chevolleaux
              Votes:
              8 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: