Skip to content
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

Add base Dockerfile and add caching for go build #683

Merged
merged 7 commits into from
Feb 26, 2024

Conversation

RonFed
Copy link
Contributor

@RonFed RonFed commented Feb 21, 2024

No description provided.

@RonFed RonFed changed the title Add base Dockerfile for apt packages, and add caching for go build Add base Dockerfile and add caching for go build Feb 21, 2024
@RonFed RonFed marked this pull request as ready for review February 21, 2024 10:29
@RonFed RonFed requested a review from a team as a code owner February 21, 2024 10:29
Copy link
Contributor

@damemi damemi left a comment

Choose a reason for hiding this comment

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

@RonFed could you please add some details about what this is doing? I also have a couple questions:

  • Are we going to publish the new base image?
  • What are the reasons for building a separate .base image over just multi-stage docker builds?

I'm assuming this helps with faster build times and maybe multi-arch builds? Is that just for our CI/builds or does that help users too?

Dockerfile.base Outdated Show resolved Hide resolved
@RonFed
Copy link
Contributor Author

RonFed commented Feb 21, 2024

@RonFed could you please add some details about what this is doing? I also have a couple questions:

  • Are we going to publish the new base image?
  • What are the reasons for building a separate .base image over just multi-stage docker builds?

I'm assuming this helps with faster build times and maybe multi-arch builds? Is that just for our CI/builds or does that help users too?

Sure. The main motivation behind this is to make the build process faster for development. Running make docker-build or make docker-generate locally is made much faster with caching especially make docker-build. The base image saves re-downloading all the apt packages, and the --mount helps with caching the go packages.
I thought the separate base Dockerfile could be helpful for some of the Makefile targets (avoiding the apt installs). Can this be achieved by adding it as a build-stage?

@damemi
Copy link
Contributor

damemi commented Feb 21, 2024

Thanks for the explanation @RonFed!

I thought the separate base Dockerfile could be helpful for some of the Makefile targets (avoiding the apt installs). Can this be achieved by adding it as a build-stage?

No, I think what you're doing here is right for that. I just wasn't sure what the main goal was so I wanted to pose that question.

@RonFed RonFed marked this pull request as draft February 22, 2024 18:39
@RonFed RonFed marked this pull request as ready for review February 22, 2024 21:35
@RonFed
Copy link
Contributor Author

RonFed commented Feb 25, 2024

@damemi I figured it is possible to do it with one Dokcerfile and use the base as the first stage, so I modified it back to a single file.

docker-build-base:
	docker buildx build -t $(IMG_NAME_BASE) --target base .

@MrAlias MrAlias merged commit 1ba2dd9 into open-telemetry:main Feb 26, 2024
17 checks passed
@RonFed RonFed deleted the base_dockerfile branch February 27, 2024 09:03
@damemi damemi mentioned this pull request Mar 26, 2024
@MrAlias MrAlias added this to the v0.11.0-alpha milestone Mar 28, 2024
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.

None yet

3 participants