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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

b: same here

Copy link
Collaborator

Choose a reason for hiding this comment

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

b: we should not change anything in inventories .yaml files. Those changes were introduced by me to be able to generate final Dockerfiles. After this they are not needed

Copy link
Collaborator

Choose a reason for hiding this comment

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

file permission were changed so I can run the script manually, but this was a mistake. It should be reverted

Copy link
Collaborator

Choose a reason for hiding this comment

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

This script should be removed and only added in the PR description as information how we generated the Dockerfiles

@@ -6,13 +6,13 @@ images:
- name: init-appdb
vars:
context: .
template_context: docker/mongodb-kubernetes-init-database
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@MaciejKaras Should we keep this renaming ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would rather keep the same name here to prevent any changes. mongodb-kubernetes-init-appdb can unused for now

@@ -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
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

Comment on lines +21 to +22
RUN CGO_ENABLED=0 GOFLAGS=-buildvcs=false go build -o /readinessprobe ./mongodb-community-operator/cmd/readiness/main.go
RUN CGO_ENABLED=0 GOFLAGS=-buildvcs=false go build -o /version-upgrade-hook ./mongodb-community-operator/cmd/versionhook/main.go
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should we have these two go build commands in just one RUN statement? That would result into less layers and potentially smaller image.

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