Description
In creating-a-container-with-a-multi-stage-docker-build guide there is a Maven docker base image with GraalVM capabilities.
It would be nice if there was one for projects using Gradle as well.
cc @cescoffier
Yes, that's relatively easy. We already have a module installing Gradle.
We just need:
1 - add Gradle to https://github.com/quarkusio/quarkus-images/blob/master/quarkus-maven-overrides-java8.yaml#L27
2 - Rename the image
3 - Update the documentation
The hardest, as usual, would be to find the right name for this image...
The hardest, as usual, would be to find the right name for this image...
centos-quarkus-gradle?
The same image would provide maven and gradle.
Maybe something like centos-quarkus-builder since it's meant to be used to build the app :)
@fmhwong maybe you could have a look at that one too?
@cescoffier Do you have a preference of making a copy of quarkus-maven-overrides-java8.yaml and quarkus-maven-overrides-java11.yaml, making the changes in the copy and check them in OR modify the existing files?
Maybe it will be useful to someone. This is a quick workaround
## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/centos-quarkus-maven:19.3.1-java11 AS build
COPY src /usr/src/app/src
COPY gradle /usr/src/app/gradle
COPY gradlew /usr/src/app
COPY build.gradle.kts /usr/src/app
COPY settings.gradle.kts /usr/src/app
COPY gradle.properties /usr/src/app
USER root
RUN chown -R quarkus /usr/src/app
USER quarkus
WORKDIR /usr/src/app/
RUN ./gradlew clean build -Dquarkus.package.type=native
## Stage 2 : create the docker final image
FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY --from=build /usr/src/app/build/*-runner /work/application
RUN chmod 775 /work
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
One thing. I use Kotlin in Gradle configuration so if you don't use Kotlin, remove extensions in build.gradle.kts and settings.gradle.kts files.
@k0staa we're deprecating gradle buildNative in favor of gradle build -Dquarkus.package.type=native. See #8325 for more details
@k0staa we're deprecating
gradle buildNativein favor ofgradle build -Dquarkus.package.type=native. See #8325 for more details
Thanks @gastaldi . I edited my post and also I change build command in my project.
Most helpful comment
Maybe it will be useful to someone. This is a quick workaround
One thing. I use Kotlin in Gradle configuration so if you don't use Kotlin, remove extensions in
build.gradle.ktsandsettings.gradle.ktsfiles.