Skip to content

feat: user multi-stage builds and remove apt and pip caches #59

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

Conversation

LucasRoesler
Copy link
Member

  1. Remove apt cache after running apt-get
  2. Pass --no-cache-dir to the pip command
  3. Use multi-stage builds to remove the test layers from the final
    image.

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 #57
Relates to #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

Hi @LucasRoesler could you rebase this PR? You'll be at 2/4 for Hacktoberfest eh? 😄

1. Remove apt cache after running `apt-get`
2. Pass `--no-cache-dir` to the `pip` command
3. Use multi-stage builds to remove the test layers from the final
   image.

Signed-off-by: Lucas Roesler <[email protected]>
@LucasRoesler LucasRoesler force-pushed the feat-remove-apt-and-pip-caches branch from ecb576b to 36b62e6 Compare October 4, 2022 08:34
@LucasRoesler
Copy link
Member Author

@alexellis done

fyi, i think the PR creation date has to be in October.. so still 0/4 ;)

@alexellis
Copy link
Member

Close it and submit another one if you like?

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.

Remove unnecessary package cache files for apt/pip, implement multistage builds to minimize container image
2 participants