Search code examples
javamavenkubernetesskaffold

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?


Solution

  • 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.