Giter VIP home page Giter VIP logo

onboarding's Introduction

Task 1: Using paketo buildpacks.

First Onboarding task

Greetings human

The first thing we are going to do is just a quick exploration of how to use the buildpacks the Paketo project produces.

Prerequisites

For this you will need a couple additional peices of software

  • pack
    • This is the CLI that orchestrates the running of each Paketo buildpack
  • docker
    • Provides a image registry on all platforms.
  • sample_application
    • just a simple application nodejs application we are going to build This app will be used throughout this tutorial so it is recommended that you use it

First task

We are going to is just build the same application into an app-image using pack in three different ways

  1. Build using a builder
  2. Build using a metabuildpack
  3. Build using an implementation buildpack

Using a Builder

Given that you have installed the above pre-requisites and started the docker daemon. We can now set up pack to use a builder!

list all the pre-packaged builders

pack list-trusted-builder

For this tutrorial we are going to use the gcr.io/paketo-buildpacks/builders:base builder. So to set this as the default we run

pack set-default-builder gcr.io/paketo-buildpacks/builders:base

Ok great! Now from the root of the sample_application cloned as a prerequisite simply run:

pack build onboarding-test-image

After a bit of output our build succeeds and we have an actual application image. Running

docker images

lists all images and we will see that indeed the onboarding-test-image is present.

Quick Questions & A

Ok so a lot happend in that last step lets go through some diagrams and deffinitions to show how all these piece fit togeather at a high level to produce our final onboarding-test-image image.

What is an image?

For our purposes an app image image is just a collection on layers or which are just addition or deletions to the filesystem.

The images we will be producing have three distinct types of layers,

  • a layer for our application source (for interpreted languages)
  • layer(s) for our application's dependencies
  • an OS layer that contains operating system packages.

TODO: Layers graphic here

For a closer look at the contents of each layer try using the dive tool.

A General picture about how these interact:

TODO: graphic around pack + buildpacks = sample app

What is a Builder

Simply a builder is a collection of buildpacks, some data indicating what order they should be run in, and a stack, which provides the OS packages.

We can get some more information about exactly what buildpacks and what OS packages our Builder is going to provide by running

pack inspect-builder

This will give some structured output that gives us the buildpacks on the builder and the stack!

Stack = 'io.buildpacks.stacks.bionic'

Lifecycle = "don't worry about this yet"
...

Run Images = "don't worry about this yet"
...

Buildpacks = "long list of all buildpacks in this builder"
...

Detection Order = "don't worry about this yet"
...

We can expand a bit on our above graphic.

The buildpacks provide you application dependencies, while the stack is what provides the OS packages

TODO: expanded graphic showing stacks and buildpacks.

Summary

So in summary we see that the default builders that come with pack come with buildpacks and a stack. These are responsible for all the layers below your app layer. Which is why you only need to bring your app and you can just pack build an application image.

Now lets move onto another way of pack building our application

Using a metabuildpack

Continuing where we left off after building our application using a builder. We can also specify a metabuildpack or a group of buildpacks that we would like to use. When building our app using a builder we used 2 buildpacks node-engine & npm.

This time lets build our application using the gcr.io/paketo-buildpacks/nodejs metabuildpack, which contains the node-engine, npm and yarn implementation buildpacks.

this is as simple as sitting in the root of the sample_application

pack build metabuildpack-build-test --buildpack gcr.io/paketo-buildpacks/nodejs

Using implementation buildpacks

And finally notice we used the node-engine and NPM buildpacks to build our application we can specify just those buildpacks as follows

pack build implementation-build-test --buildpack gcr.io/paketo-buildpacks/nodejs --buildpack gcr.io/paketo-buildpacks/npm

onboarding's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.