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

modified Dockerfile source images to use smaller base images #218

Merged

Conversation

bradkwadsworth-mw
Copy link
Contributor

Description of your changes

Recently I've been wanting to follow this method https://github.com/crossplane-contrib/function-kcl?tab=readme-ov-file#use-as-a-base-image for building custom Crossplane functions that includes schemas of the managed resources. With this workflow, a container will need to be built per composition. While I don't have an issue with this, the base image being 383MB is a little on the large side. This PR changes the base images in the Dockerfile and shrinks the golang binary using ldflags causing the new image size to be 156MB.

I have:

  • Read and followed Crossplane's contribution process.
    - [ ] Added or updated unit tests for my change.

@Peefy
Copy link
Collaborator

Peefy commented Jan 3, 2025

Thanks for this PR.

However, if some content like git and ca-certificates in the basic image kcllang/kcl is missing, it may cause certain features such as OCI, Git Source, etc. to be unavailable. We can find some basic dependencies here https://github.com/kcl-lang/cli/blob/main/Dockerfile

Perhaps we can further reduce the size of kcllang/kcl. How do you think? cc @zong-zhe @He1pa

@bradkwadsworth-mw
Copy link
Contributor Author

That sounds good to me I'll take a look at reducing the kcllang/kcl image. I'll modify this one to just add the ldflags to help reduce the Go binary size.

@Peefy
Copy link
Collaborator

Peefy commented Jan 4, 2025

Thank you! LGTM!

@Peefy Peefy merged commit 837f319 into crossplane-contrib:main Jan 4, 2025
7 checks passed
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.

2 participants