Skip to content

CLOUDP-333181: Combined dockerfiles #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 28, 2025
Merged

Conversation

Julien-Ben
Copy link
Collaborator

@Julien-Ben Julien-Ben commented Jul 23, 2025

Summary

Since we will stop re-building images daily, we won't have -context images anymore. We then don't need Dockerfiles templating.
This PR creates self-sufficient Dockerfiles that build our images without templating. They only need variables passed with ARG.
For images which already had a plain Dockerfile, it was renamed Dockerfile.old, and inventories modified accordingly.

For now, we keep templates and Sonar, until the Atomic Release epic is completed and we fully get rid of all of it.

Proof of Work

The proof of work will come when actually using them in a build pipeline. In a future PR.
This one is a noop, Dockerfiles are created but not used yet.

Methodology

The Dockerfiles were automatically generated, using Sonar templating, by adding special final_dockerfile tag to stages necessary to generate one. Using code like:

def test_build_init_database_dockerfile():  
    process_image(  
        image_name="init-database",  
        skip_tags=["release"],  
        include_tags=["final_dockerfile"],  
        build_args={  
            "registry": "localhost:5000",  
            "version": "1.1.0",  
            "is_appdb": False,  
            "mongodb_tools_url_ubi": "https://downloads.mongodb.org/tools/db/mongodb-database-tools-rhel93-x86_64-100.12.0.tgz",  
        },  
        build_options={},  
        inventory="inventories/init_database.yaml",  
    )  

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you checked for release_note changes?

MaciejKaras and others added 2 commits July 23, 2025 10:46
Combined Dockerfiles for MongoDB Kubernetes Operator
Combined Dockerfiles for Init Ops Manager image
Combined Dockerfiles for Init Database and Init AppDB
Combined Dockerfiles for Database
Combined Dockerfiles for upgrade-hook and readinessprobe
Added agent Dockerfiles
Created Dockerfile for OpsManager
Removed Dockerfile.dcar and README.md about how to build it
Add more gitgraphs
@Julien-Ben Julien-Ben requested a review from MaciejKaras July 23, 2025 08:55
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this file is not used anywhere (this why I have removed it), but please double check.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, the LICENSE file was unused I think

@@ -0,0 +1,60 @@
ARG imagebase
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For review: Dockerfile.old files are the copy of the initial Dockerfile

@@ -22,7 +22,6 @@ images:
- name: init-appdb-template-ubi
task_type: dockerfile_template
template_file_extension: ubi_minimal
tags: ["ubi"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets keep this tag

@Julien-Ben
Copy link
Collaborator Author

I see that init_release_agents_on_ecr ran (and failed) on some commits, I'm confused why

@Julien-Ben Julien-Ben requested review from nammn and lucian-tosa July 25, 2025 12:28
@Julien-Ben Julien-Ben marked this pull request as ready for review July 25, 2025 12:28
@Julien-Ben Julien-Ben requested a review from a team as a code owner July 25, 2025 12:28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep in mind that we should get rid of this image entirely CLOUDP-329374.
But we can merge it for now and make that change before 1.3

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are the same apart from the:

  • upgrade hook
  • different docker labels

If we want this to be the same file, with the same contents and labels, I'm fine. I don't know if we should do it as part of atomic, or do it a little later.

Copy link
Contributor

@viveksinghggits viveksinghggits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Julien-Ben Julien-Ben merged commit 07a91dc into master Jul 28, 2025
31 of 35 checks passed
@Julien-Ben Julien-Ben deleted the combined-dockerfiles branch July 28, 2025 09:54
MaciejKaras added a commit that referenced this pull request Aug 11, 2025
…ros propagation (#328)

# Summary

Fixes issue with conflicting `Dockerfile` files on master. Sonar is
creating Dockerfiles in the directory where new Dockerfile existed
already. They were added here ->
#289.

Additionally another PR
#267 made changes to
how the agent images were built and especially to agent Dockerfile ARGs:

https://github.com/mongodb/mongodb-kubernetes/blob/89866b79233745e27ade51dc2d9fd0e73c6124e5/docker/mongodb-agent/Dockerfile#L3-L6

This conflicted with
#303 where new
`atomic_pipeline.py` was still depending on the old Dockerfile
structure:


https://github.com/mongodb/mongodb-kubernetes/blob/774bbaca930a1752060cfe5e5bf60f24cd6c999c/docker/mongodb-agent/Dockerfile#L25-L26

## Proof of Work

Passing CI (especially agent build task)

## Checklist

- [ ] Have you linked a jira ticket and/or is the ticket in the title?
- [ ] Have you checked whether your jira ticket required DOCSP changes?
- [x] Have you added changelog file?
    - use `skip-changelog` label if not needed
- refer to [Changelog files and Release
Notes](https://github.com/mongodb/mongodb-kubernetes/blob/master/CONTRIBUTING.md#changelog-files-and-release-notes)
section in CONTRIBUTING.md for more details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants