openfaas / python-flask-template

HTTP and Flask-based OpenFaaS templates for Python 3
MIT License
85 stars 86 forks source link

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

Closed LucasRoesler closed 1 year ago

LucasRoesler commented 1 year ago

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

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

Checklist:

alexellis commented 1 year ago

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

Could you rebase it onto HEAD?

LucasRoesler commented 1 year ago

@alexellis done

alexellis commented 1 year ago

Looks good, thank you!

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