buildpack introduction

Back in the days, we create dockerfile and provides sets of command such as 

FROM base-image

RUN npm install 

And it all looks really familiar.  Often times, we forgot some command and the app won't be able to run. There are also times - where it took us hours trying to figure out how to install the required component. 

Build packs helps by automatically analyzing your code and then tries to build an image out of it.  Let's say you have a java app and it is using maven. When you run command in your source directory as shown below:- 

 pack build myapp --builder cnbs/sample-builder:jammy

Buildpacks would automatically infer what time of app you're running on and then build a working image ready for deployment or testing

Getting started. 

Install buildpacks 

Then close some samples, git clone https://github.com/buildpacks/samples

    For some reason, it only works for java. :) 

      cd samples/apps/java-maven
      
      pack build myapp --builder cnbs/sample-builder:jammy

      Then run 


      docker run --rm -p 8080:8080 myapp

      You should be able to see this:-


      Breaking down what happened 

      pack build is the command to build an image. Then follow by myapp - which is the name of your image. 

      The builder here - typically means are images that you can use to build with your app. 

      You can always run 

      pack builder suggest

      To see what builder you can use. I still don't have much luck getting buildpack to figure out how to build my dotnet app. 





      Comments

      Popular posts from this blog

      The specified initialization vector (IV) does not match the block size for this algorithm