Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool!
Just some minor comments regarding getting the sample running more smoothly.
@@ -0,0 +1,57 @@ | |||
#### | |||
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was this file auto-generated by something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup - this code was generated from the Quarkus equivalent of Initialzr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome; did not test :)
google-cloud-graalvm-samples/quarkus-pubsub-sample/src/main/java/com/example/PubSubUtils.java
Outdated
Show resolved
Hide resolved
@kostacasa - Hey sorry to bother you. I wanted to ask about your native image builds on Cloud Build. We've been able to get a quarkus sample app working with the Pub/Sub libraries locally (compilation + running), however when we try to build the quarkus app on Cloud Build we seem to get a new error. I was just curious if you've seen this before and have handled it -- however, if not, no worries! (figure it was worth a shot asking). To me it seemed like it might be a Cloud Build-specific error.
|
Hello! Interesting, have not seen that specific error unfortunately. This is the Dockerfile we use for building native images:
And our cloud build step is just a simple docker builder execution (we pull .m2 cache first). # Retrieve the cached .m2 directory from GCS
- name: 'gcr.io/cloud-builders/gsutil'
entrypoint: bash
args:
- '-c'
- |
mkdir -p .m2/repository/
cd .m2/repository/
gsutil cp gs://m2_cache/$REPO_NAME.tar .
if [ -f "$REPO_NAME.tar" ]; then
echo "Extracting archive"
tar -xf $REPO_NAME.tar
echo "Extracted"
rm $REPO_NAME.tar
ls
fi
true
- name: gcr.io/cloud-builders/docker
args:
- build
- '--file=src/main/docker/Dockerfile.multistage'
- '--tag=$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME:$SHORT_SHA'
- '--network=cloudbuild'
- '.' |
Ahh thanks so much, this is very helpful. I think what might be missing for us is maybe we should also try using the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! (I didn't try the compiled version though.)
Adds a Quarkus Cloud Pub/Sub sample.
Fixes #30
Notes: I think it's possible to test this out (if you want) even if you don't have GraalVM installed. Quarkus offers the
mvn package -P graal -Dquarkus.native.container-build=true
command which conducts the build in a docker container and you should be able to run the resulting executable after./target/quarkus-pubsub-sample-1.0.0-SNAPSHOT-runner
.