CLOUD NATIVE BUILDPACKS.
● Zander Mackie
● VMware (Pivotal) 2+ years
● OSS Contributor for a while
● Lots of weird jobs before
software (cheesemaker, etc.)
● (That isn’t me with the fish)
Disclaimer
● Introductory talk
● Docker != required
● Please dig more
Agenda
● Vocab
● CN Buildpacks
● Why
● Resources
App
OS
bit
$ENV
node_m
odules
2011 2013 2015 2018 2020
1.0? +
YOU!
The big picture
stack
build image run image
build image
lifecycle
buildpack C
buildpack B
buildpack A
builder image
</>
source
run image
...
dependencies
app
app image
platform
DEMO TIME!
● Built App (pack build)
● Ran App (docker run)
● Modified app
● Rebuilt (pack build)
● Re-ran app (docker run)
</>
source Container
Image
App image is fully...
● Runnable
● Reproducible
● Deployable
OS
app
dependencies
Anatomy of a Buildpack
/detect
● Runs against source to determine buildpack applicability
● Examples:
○ A Java CNB might look for .java files or a .jar
○ An NPM CNB might look for package.json
/build
● Downloads build-time and run-time dependencies
● Compiles source (if needed)
● Sets launch command
Stacks & builders
Stack: two images that provide...
● Build-time environment
● Run-time environment (OS)
build image
run image
stack
Builder: context for building
● Buildpack binaries
● Public builders by VMw &
Heroku
● pack suggest-builders
build image
lifecycle
buildpack C
buildpack B
buildpack A
The big picture
stack
build image run image
build image
lifecycle
buildpack C
buildpack B
buildpack A
builder image
</>
source
run image
...
dependencies
app
app image
platform
Role of a platform
● Execute each lifecycle phase in order
(instance of builder image per phase)
● Examples: pack, kpack, Tekton template
Dockerfile Best Practices
https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
● Create ephemeral containers
● Understand build context
● Pipe Dockerfile through stdin
○ Build an image using a dockerfile from stdin, without sending build context
○ Build from a local build context, using a dockerfile from stdin
○ Build from a remote build context, using a dockerfile from stdin
● Exclude with .dockerignore
● Use multi-stage builds
● Don’t install unnecessary packages
● Decouple applications
● Minimize the number of layers
● Sort multi-line arguments
● Leverage build cache
. . . WAT?
Why use Cloud Native Buildpacks?
● Focus on providing value for end users
● Composable (python + bash + java)
● Build any app with the same set of buildpacks (no custom needed)
● Only rebuild layers that have changed (smart caching)
● Rebasing without rebuild (plop your app on a new base layer)
Resources
● Buildpacks.io
○ Docs
○ Tutorials
● Slack: slack.buildpacks.io
● GitHub – stars welcome ;)
○ Lots of examples: github.com/buildpacks/samples
○ Pack CLI: github.com/buildpacks/pack
○ CNB Specification: github.com/buildpacks/spec
● WG Meetings: Wed. 3-4, Thurs. 2-3 (EST).
○ Reach out on slack to get added. Working on public calendar + recordings.
● Twitter: @buildpacks_io
AllTheTalks 2020: Buildpacks - container for everyone!

AllTheTalks 2020: Buildpacks - container for everyone!

  • 1.
  • 2.
    ● Zander Mackie ●VMware (Pivotal) 2+ years ● OSS Contributor for a while ● Lots of weird jobs before software (cheesemaker, etc.) ● (That isn’t me with the fish)
  • 3.
    Disclaimer ● Introductory talk ●Docker != required ● Please dig more
  • 4.
    Agenda ● Vocab ● CNBuildpacks ● Why ● Resources
  • 5.
  • 7.
    2011 2013 20152018 2020 1.0? + YOU!
  • 8.
    The big picture stack buildimage run image build image lifecycle buildpack C buildpack B buildpack A builder image </> source run image ... dependencies app app image platform
  • 9.
    DEMO TIME! ● BuiltApp (pack build) ● Ran App (docker run) ● Modified app ● Rebuilt (pack build) ● Re-ran app (docker run)
  • 10.
  • 11.
    App image isfully... ● Runnable ● Reproducible ● Deployable OS app dependencies
  • 12.
    Anatomy of aBuildpack /detect ● Runs against source to determine buildpack applicability ● Examples: ○ A Java CNB might look for .java files or a .jar ○ An NPM CNB might look for package.json /build ● Downloads build-time and run-time dependencies ● Compiles source (if needed) ● Sets launch command
  • 13.
    Stacks & builders Stack:two images that provide... ● Build-time environment ● Run-time environment (OS) build image run image stack Builder: context for building ● Buildpack binaries ● Public builders by VMw & Heroku ● pack suggest-builders build image lifecycle buildpack C buildpack B buildpack A
  • 14.
    The big picture stack buildimage run image build image lifecycle buildpack C buildpack B buildpack A builder image </> source run image ... dependencies app app image platform Role of a platform ● Execute each lifecycle phase in order (instance of builder image per phase) ● Examples: pack, kpack, Tekton template
  • 16.
    Dockerfile Best Practices https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ ●Create ephemeral containers ● Understand build context ● Pipe Dockerfile through stdin ○ Build an image using a dockerfile from stdin, without sending build context ○ Build from a local build context, using a dockerfile from stdin ○ Build from a remote build context, using a dockerfile from stdin ● Exclude with .dockerignore ● Use multi-stage builds ● Don’t install unnecessary packages ● Decouple applications ● Minimize the number of layers ● Sort multi-line arguments ● Leverage build cache
  • 17.
    . . .WAT?
  • 19.
    Why use CloudNative Buildpacks? ● Focus on providing value for end users ● Composable (python + bash + java) ● Build any app with the same set of buildpacks (no custom needed) ● Only rebuild layers that have changed (smart caching) ● Rebasing without rebuild (plop your app on a new base layer)
  • 20.
    Resources ● Buildpacks.io ○ Docs ○Tutorials ● Slack: slack.buildpacks.io ● GitHub – stars welcome ;) ○ Lots of examples: github.com/buildpacks/samples ○ Pack CLI: github.com/buildpacks/pack ○ CNB Specification: github.com/buildpacks/spec ● WG Meetings: Wed. 3-4, Thurs. 2-3 (EST). ○ Reach out on slack to get added. Working on public calendar + recordings. ● Twitter: @buildpacks_io