0

I'm building a dockerfile via kpack without a Dockerfile and everything is working fine. Using the "tiny" builder the image is even slim enough, what I don't understand is how to add external packages. For example I need to install a font, is available in alpine as "FONTX" and I can install it simply in a dockerfile with RUN apk --no-cache add FONTX.

How can I do it with kpack, in particular with kpack cli?

At the moment I create the image with:

kp image save $MYIMAGE --tag MYREGISTRY/MYREPO/MYIMAGE:MYTAG --git $GITURL --git-revision $GIT_COMMIT

I have tried to a blob and call it with --blob during the image building but it is not only ugly but even difficult to maintain. I would prefer something versionable.

Roberto
  • 1
  • 3
  • I would suggest trying one of the options from here -> https://stackoverflow.com/questions/62484649/how-to-add-extra-linux-dependencies-into-a-spring-boot-buildpack-image?rq=2. It doesn't matter that you're using kpack vs pack vs Spring Boot build tools. They are all using Buildpacks so the options should apply. – Daniel Mikusa Apr 03 '23 at 12:39
  • The options in the thread above are not really viable to me. I'm thinking about creating a custom builder but... to be honest this is much worse than write a dockerfile. – Roberto Apr 03 '23 at 22:07
  • You pay a penalty for using the tiny image because it doesn't have any tools present to install additional packages. Even if you used a Dockerfile and based on the tiny run image, you couldn't add packages (you'd have to do something more convoluted to make it work). It's just a very trimmed-down base image. Also, apologizes I linked you to the wrong SO post, try https://stackoverflow.com/questions/69447497/is-it-possible-to-customize-docker-image-generated-with-spring-native-with-buil/69466535#69466535 – Daniel Mikusa Apr 04 '23 at 18:24
  • I would suggest trying option #4, apt-buildpack. It works in a lot of cases and you can use it here because it will run at build time on the tiny build image which I believe does have apt available. It then copies over the library files to the run image automatically, so you get packages and a slim run image. – Daniel Mikusa Apr 04 '23 at 18:27
  • Thanks, at the end I have created a custom image coming from base-jammy and a custom clusterstack – Roberto Apr 05 '23 at 19:34

0 Answers0