Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDays Montreal
anthonydahanne
47 views
20 slides
May 28, 2024
Slide 1 of 20
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
About This Presentation
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incub...
Les Buildpacks existent depuis plus de 10 ans ! D’abord, ils étaient utilisés pour détecter et construire une application avant de la déployer sur certains PaaS. Ensuite, nous avons pu créer des images Docker (OCI) avec leur dernière génération, les Cloud Native Buildpacks (CNCF en incubation). Sont-ils une bonne alternative au Dockerfile ? Que sont les buildpacks Paketo ? Quelles communautés les soutiennent et comment ?
Venez le découvrir lors de cette session ignite
Size: 2.42 MB
Language: en
Added: May 28, 2024
Slides: 20 pages
Slide Content
Paketo Buildpacks :
la meilleure façon de
construire des
images OCI?
Devops Days Ignite,
Montréal, 28 Mai 2024
Anthony Dahanne
Software Engineer
@[email protected]
https://blog.dahanne.net
2
What are buildpacks?
Detect and build!
Java Buildpack ⚙
java –jar my-app.jar
3
What are buildpacks?
Detect and build!
Python Buildpack ⚙
Java Buildpack ⚙
java –jar my-app.jar
python3 server.py
4
What are buildpacks?
Detect and build!
Heroku
5
What are buildpacks?
Detect and build!
Heroku
6
What are buildpacks?
Detect and build!
CloudFoundry
7
8
What are Cloud Native buildpacks?
Detect and build an OCI image!!
Buildpacks v3
9
Where do they come from?
A spec and CLI under the CNCF umbrella
https://buildpacks.io
https://github.com/buildpacks
10
Where do they come from?
Basically 3 big implementers
11
What’s a Paketo?
OSS buildpacks implementations
https://paketo.io
https://github.com/paketo-buildpacks
12
Why Paketo buildpacks over … the Dockerfile?
Benefit from maintainers expertise
FROM openjdk
COPY target/*runner.jar/app/app-runner.jar
WORKDIR /app
EXPOSE 8080
ENTRYPOINT [ "java","-jar" ]
CMD ["app-runner.jar"]
java –jar app-runner.jar
13
Why Paketo buildpacks over … the Dockerfile?
Benefit from maintainers expertise
FROM openjdk
COPY target/*runner.jar/app/app-runner.jar
WORKDIR /app
EXPOSE 8080
ENTRYPOINT [ "java","-jar" ]
CMD ["app-runner.jar"]
java –jar app-runner.jar
pack build –builder paketobuildpacks/builder:basemy-app
Setting Active Processor Count to 5
Calculating JVM memory based on 15788052K available memory
Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -
Xmx15397353K -XX:MaxMetaspaceSize=83498K -
XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 15788052K,
Thread Count: 50, Loaded Class Count: 12328, Headroom: 0%)
Enabling Java Native Memory Tracking
Adding 137 container CA certificates to JVM truststore
Spring Cloud Bindings Enabled
Picked up JAVA_TOOL_OPTIONS: -
Djava.security.properties=/layers/paketo-buildpacks_bellsoft-
liberica/java-security-properties/java-security.properties -
XX:+ExitOnOutOfMemoryError -XX:ActiveProcessorCount=5 -
XX:MaxDirectMemorySize=10M -Xmx15397353K -
XX:MaxMetaspaceSize=83498K -XX:ReservedCodeCacheSize=240M -Xss1M -
XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=summary -
XX:+PrintNMTStatistics -
Dorg.springframework.cloud.bindings.boot.enable=true
14
Why Paketo buildpacks over … the Dockerfile?
Benefit from the ecosystem for common use cases : custom CA certificate
FROM openjdk
WORKDIR /app
COPY custom-ca.crt/app
RUN keytool -importcert -file custom-
ca.crt-alias custom-ca.crt-cacerts -
storepass changeit -noprompt
EXPOSE 8080
ENTRYPOINT [ "java","-jar" ]
CMD ["app-runner.jar"]
FROM golang:1.15 AS builder
RUN apk update
RUN apk add -U --no-cache ca-certificates &&
update-ca-certificates
WORKDIR /GreetingAPI
COPY . /greeting
WORKDIR /greeting
ENV GO111MODULE=on
RUN CGO_ENABLED=0 GOOS=linux go build -o greeting
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-
certificates.crt /etc/ssl/certs/
COPY --from=builder /greeting .
CMD ["./greeting"]
15
Why Paketo buildpacks over … the Dockerfile?
Benefit from the ecosystem for common use cases : custom CA certificate
FROM openjdk
WORKDIR /app
COPY custom-ca.crt/app
RUN keytool -importcert -file custom-
ca.crt-alias custom-ca.crt-cacerts -
storepass changeit -noprompt
EXPOSE 8080
ENTRYPOINT [ "java","-jar" ]
CMD ["app-runner.jar"]
FROM golang:1.15 AS builder
RUN apk update
RUN apk add -U --no-cache ca-certificates &&
update-ca-certificates
WORKDIR /GreetingAPI
COPY . /greeting
WORKDIR /greeting
ENV GO111MODULE=on
RUN CGO_ENABLED=0 GOOS=linux go build -o greeting
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-
certificates.crt /etc/ssl/certs/
COPY --from=builder /greeting .
CMD ["./greeting"]
pack build java-app --volume
$PWD/binding/ca-
cer9ficates/:/pla>orm/bindings/my-cer9ficates
--builder=paketobuildpacks/builder:base
pack build go-app --volume $PWD/binding/ca-
cer9ficates/:/pla>orm/bindings/my-cer9ficates
--builder=paketobuildpacks/builder:base
16
Why Paketo buildpacks over … the Dockerfile?
SBOM generation out of the box!
pack sbom download myapp --output-dir ./app-sbom
17
How to integrate them to my existing environment?
•They’re images pushed to a registry, so you can keep your existing workflow
•Building images natively from Kubernetes, using kpack
•From the developer toolchain:
•Spring Boot Maven / Gradle plugins
•Use an existing PaaS
•Heroku, Google Cloud Build fly.io, Porter, etc.
•Ready to run PaaS
•Tanzu Application Platform, Suse Epinio, etc.
18
How to integrate them to my existing environment?
•They’re images pushed to a registry, so you can keep your existing workflow
•Building images natively from Kubernetes, using kpack
•From the developer toolchain:
•Spring Boot Maven / Gradle plugins
•Use an existing PaaS
•Heroku, Google Cloud Build fly.io, Porter, etc.
•Ready to run PaaS
•Tanzu Application Platform, Suse Epinio, etc.