Victor
Victor

Reputation: 8480

Using Skaffold with Java

I was testing Skaffod and It is a great tool for microservices development. But I do not find any tutorial on how to use it with Java. Is there any support to Maven builds?

Upvotes: 1

Views: 2244

Answers (3)

albertocavalcante
albertocavalcante

Reputation: 611

I haven't tried it yet, but alternatively now it allows you to specify a custom build script: Custom Build Script

I'm assuming you could try as below, or source a build.sh as their documentation exemplifies.

build:
  artifacts:
  - image: my-image
    custom:
      buildCommand: mvn package && docker build .

Upvotes: 0

Balint Pato
Balint Pato

Reputation: 1549

Skaffold now supports JIB out of the box which will be more efficient than multistage Dockerfile building! Check out the JIB Maven example in Skaffold.

Upvotes: 1

Vishal Biyani
Vishal Biyani

Reputation: 4407

There is a discussion going on about adding support for Java apps here, you can very much use Docker multistage build with Skaffold. A probably working example is available here

Your build portion of Skaffold file will look something like:

apiVersion: skaffold/v1alpha2
kind: Config
build:
  tagPolicy:
    dateTime:
      format: 2006-01-02_15-04-05.999_MST
      timezone: Local
  artifacts:
  - imageName: <repo>/<image>
    workspace: ./appdir

In the appdir - you can use a multistage Dockerfile and integrate with rest of the workflow. Multistage Dockefile will build artefact in one stage and create a container using the artefact of the first stage.

Upvotes: 1

Related Questions