docker build: make sure venvs are owned by flytekit #3299
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR optimizes docker image size by giving ownership of the micromamba python installation and virtual environments created during the image build process on the same layer that creates the virtual environment. This avoids layer duplication.
Note: Setting
USER flytekitbefore the python venv installation commands leads to various issues, e.g.poetrypackage installation doesn't work because theflytekituser doesn't seem to have certain necessary network access whilerootdoes.Summary by Bito
This pull request optimizes the Docker image build process by ensuring that virtual environments and micromamba Python installations are owned by the flytekit user, reducing image size and avoiding layer duplication. Adjustments to the Dockerfile commands address issues with running as a non-root user.