Jim Wharton
Jim Wharton

Reputation: 1415

With Quarkus, how do I build a native image in a docker image (with Kotlin and Gradle)

The Quarkus documentation explains how to build a docker image using Maven. But I'm using Gradle and Kotlin. I'm trying to figure out how to do these steps:

FROM quay.io/quarkus/centos-quarkus-maven:19.2.1 AS build
COPY src /usr/src/app/src
COPY pom.xml /usr/src/app
USER root
RUN chown -R quarkus /usr/src/app
USER quarkus
RUN mvn -f /usr/src/app/pom.xml -Pnative clean package

First, I think I'd want an image that has gradle instead of maven (quay.io doesn't seem to have one). Then I'd have to figure what else I need to copy (instead of pom.xml) Maybe build.gradle? settings.gradle? gradle.properties? Secondly, I believe this image also contains GraalVM. So I'm not sure about what I could do there.

Do I have to use Maven? I really, really do not want to.

Upvotes: 1

Views: 1908

Answers (1)

geoand
geoand

Reputation: 64039

Although the documentation and builer image are tailored towards maven, you can however use Gradle if you do something like:

FROM quay.io/quarkus/centos-quarkus-maven:19.2.1 AS build
COPY gradlew /usr/src/app
COPY gradle /usr/src/app
COPY src /usr/src/app/src
COPY build.gradle /usr/src/app
COPY settings.gradle /usr/src/app
USER root
RUN chown -R quarkus /usr/src/app
USER quarkus
RUN ./gradlew build

Depending on what your .dockerignore contains, you might need to adapt it as well (or just remove it)

Upvotes: 3

Related Questions