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

feat: use chown during copy to reduce image size and build time #58

Merged

Conversation

LucasRoesler
Copy link
Member

Using the --chown flag during COPY is much faster than running
chown -R. It also removes a layer from the image, resulting in faster
and smaller builds.

Motivation and Context

  • I have raised an issue to propose this change (required)
  • My issue has received approval from the maintainers or lead with the design/approved label

Resolves #55

How Has This Been Tested?

$ faas-cli new echo0 --lang python3-flask 
$ faas-cli new echo1 --lang python3-http


$ faas-cli build -f echo0.yml --no-cache
# truncated
Image: echo0:latest built.
[0] < Building echo0 done in 37.65s.
[0] Worker done.

Total build time: 37.65s

$ faas-cli build -f echo1.yml --no-cache
# truncated
Image: echo1:latest built.
[0] < Building echo1 done in 32.50s.
[0] Worker done.

Total build time: 32.50s

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@alexellis
Copy link
Member

Sorry I missed this or let it fall off the radar.

Could you rebase it onto HEAD?

Using the `--chown` flag during `COPY` is much faster than running
`chown -R`. It also removes a layer from the image, resulting in faster
and smaller builds.

Resolves openfaas#55

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
@LucasRoesler
Copy link
Member Author

@alexellis done

Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

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

LGTM

@alexellis alexellis merged commit 56b349d into openfaas:master Oct 4, 2022
@alexellis
Copy link
Member

Looks good, thank you!

I'll cut a release so that people can pin this revision if they want to.

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.

extra chown command pads image size and build time
2 participants