Skip to content

Latest commit

 

History

History
209 lines (162 loc) · 5.48 KB

File metadata and controls

209 lines (162 loc) · 5.48 KB

Buildpacks demo

Prerequisites

Don’t forget first to be logged to your favorite registry and to have the permissions to push an image

Example:

QUAY_USERNAME="<QUAY_USERNAME>"
QUAY_PASSWORD="<QUAY_PASSWORD>"
docker logout quay.io
docker login -u $QUAY_USERNAME -p $QUAY_PASSWORD quay.io
💡

You can easily and locally run a kubernetes cluster using kind with the scripts developed by the Snowdrop team

curl -s -L "https://raw.githubusercontent.com/snowdrop/k8s-infra/main/kind/kind.sh" | bash -s install
curl -s -L "https://raw.githubusercontent.com/snowdrop/k8s-infra/main/kind/registry.sh" | bash -s install --registry-name kind-registry.local

Quarkus and buildpacks

cd ~/temp; rm -rf quarkus-hello

mvn io.quarkus.platform:quarkus-maven-plugin:3.3.2:create \
-DprojectGroupId=me.snowdrop \
-DprojectArtifactId=quarkus-hello \
-DprojectVersion=1.0 \
-Dextensions='resteasy-reactive,kubernetes,buildpack'

cd quarkus-hello

./mvnw install -Dquarkus.container-image.build=true \
   -Dquarkus.buildpack.jvm-builder-image=paketobuildpacks/builder-jammy-tiny:0.0.211 \
   -Dquarkus.container-image.image="quay.io/ch007m/quarkus-hello:1.0" \
   -Dquarkus.buildpack.builder-env.BP_NATIVE_IMAGE="false" \
   -Dquarkus.buildpack.builder-env.BP_MAVEN_BUILT_ARTIFACT="target/quarkus-app/lib/ target/quarkus-app/*.jar target/quarkus-app/app/ target/quarkus-app/quarkus/" \
   -Dquarkus.buildpack.builder-env.BP_MAVEN_BUILD_ARGUMENTS="package -DskipTests=true -Dmaven.javadoc.skip=true -Dquarkus.package.type=fast-jar"

Test the quarkus application

docker push quay.io/ch007m/quarkus-hello:1.0
docker run --platform linux/amd64 -i --rm -p 8080:8080 quay.io/ch007m/quarkus-hello:1.0 &

Using curl or http

http :8080/hello

Using Pack client

cd ~/temp; rm -rf quarkus-hello

mvn io.quarkus.platform:quarkus-maven-plugin:3.3.2:create \
  -DprojectGroupId=me.snowdrop \
  -DprojectArtifactId=quarkus-hello \
  -DprojectVersion=1.0 \
  -Dextensions='resteasy-reactive,kubernetes,buildpack'

cd quarkus-hello
./mvnw clean package

pack build quay.io/ch007m/quarkus-hello --path . \
  --builder quay.io/snowdrop/ubi-builder:0.1.1 \
  --volume $HOME/.m2:/home/cnb/.m2:rw \
  --publish

Let’s pull the image

IMAGE=quay.io/ch007m/quarkus-hello:latest
docker pull $IMAGE
docker run -i --rm -p 8080:8080 $IMAGE &

Test the quarkus application

http :8080/hello

Pack and extension

cd ~/temp; rm -rf nodejs-rest-http
git clone https://github.com/nodeshift-starters/nodejs-rest-http
cd nodejs-rest-http

pack build quay.io/ch007m/nodejs-pack-test \
  --path . \
  --builder paketobuildpacks/builder-ubi8-base \
  --publish

Let’s pull the image

docker pull quay.io/ch007m/nodejs-pack-test
docker run --platform linux/amd64 -i --rm -p 8080:8080 quay.io/ch007m/nodejs-pack-test &

Test the quarkus application

http :8080/api/greeting name==charles

Tekton Pipeline

You can install first Tekton, Dashboard and ingress route on kind using the commands:

./scripts/play-with-tekton install-tekton
./scripts/play-with-tekton install-tekton-dashboard

See catalog: Pipeline and tasks

💡

Review the instructions defined within the ./scripts/play-with-tekton !

Next play with a pipelinerun:

./scripts/play-with-tekton /Users/cmoullia/code/redhat-buildpacks/testing/k8s/tekton/examples/pipeline-run-quarkus.yml
./scripts/play-with-tekton /Users/cmoullia/code/redhat-buildpacks/testing/k8s/tekton/examples/pipeline-run-nodejs-extension.yml

RHTAP - PipelineRun embedding PipelineSpec

Use script:

./scripts/rhtap-demo1

RHTAP - PipelineRun with a reference to a Pipeline

Use script:

./scripts/rhtap-demo2

RHTAP - PipelineRun with a reference and NodeJS extension

Use script:

./scripts/rhtap-demo3

Additional commands

echo "To trigger a build manually on a custom pipelineRun in a git repo"
REPO_NAME=rhtap-buildpack-demo-2
sed -i.bak "s|test-0|test-1|g" .tekton/$REPO_NAME-push.yaml
cd ../$REPO_NAME; git commit -asm "Trigger a new build: 1"; git push