Skip to content

@AkshataABhat: Dockerfile enhancement: multistage build #995

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 3 commits into
base: main
Choose a base branch
from

Conversation

DonggeLiu
Copy link
Collaborator

Contributed by @AkshataABhat via #991.

AkshataABhat and others added 2 commits April 16, 2025 11:27
This issue aims to refactor the current Dockerfile to use a multistage
build approach. The motivation for this change is to:

1. Reduce final image size by excluding unnecessary build-time
dependencies (e.g., gcc, libpython3-dev, etc.)
2. Enhance maintainability by clearly separating build and runtime
concerns
```
Size of the current docker image: 3.82GB
Size of the docker image after multi-stage build: 1.06GB

```

Closes #990
@DonggeLiu
Copy link
Collaborator Author

/gcbrun exp -n ab -ag

@DonggeLiu
Copy link
Collaborator Author

@AkshataABhat, unfortunately the experiment failed:
image

@AkshataABhat
Copy link

@DonggeLiu I think I've figured out the issue. The python binary doesn't seem to exist in the second stage. I will correct this.

Copy link
Collaborator

@DavidKorczynski DavidKorczynski left a comment

Choose a reason for hiding this comment

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

Overall I'm not a huge fan of this -- do we really need it? I feel the complexity of the set up increases using multistage builds and I don't see a significant win from splitting it up.

@AkshataABhat
Copy link

At the moment, there's no significant improvement except a decrease in image size, but this can help isolate build dependencies from the runtime environment in the future, when support for fine-tuned or custom models is added.

@Kartikayy007
Copy link
Contributor

Overall I'm not a huge fan of this -- do we really need it? I feel the complexity of the set up increases using multistage builds and I don't see a significant win from splitting it up.

I agree to for the complexity point

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