Class JkDockerJvmBuild

java.lang.Object
dev.jeka.core.api.tooling.docker.JkDockerBuild
dev.jeka.core.api.tooling.docker.JkDockerJvmBuild

public class JkDockerJvmBuild extends JkDockerBuild
Docker Builder assistant for creating Docker images that run JVM applications.
Provides functionality tailored to JVM programs, such as setting classes, classpaths, agents, and Maven repositories for fetching tools.
  • Field Details

    • DEFAULT_BASE_IMAGE

      public static final String DEFAULT_BASE_IMAGE
    • repos

      protected JkRepoSet repos
  • Method Details

    • of

      public static JkDockerJvmBuild of()
      Creates a instannce.
    • of

      public static JkDockerJvmBuild of(JkBuildable buildable)
      Creates a JkDockerBuild instance for the specified JkProject.
    • buildImage

      public void buildImage(Path contextDir, String imageName)
      Description copied from class: JkDockerBuild
      Builds the Docker image with the specified image name.
      Overrides:
      buildImage in class JkDockerBuild
      Parameters:
      contextDir - the directory where the Dockerfile will be generated and from which COPY paths will be resolved.
      imageName - the name of the image to build. It may include a tag name.
    • adaptTo

      public JkDockerJvmBuild adaptTo(JkBuildable buildable)
      Adapts this JkDockerBuild instance to build the specified JkProject.
    • setClasses

      public JkDockerJvmBuild setClasses(JkPathTree classes)
      Sets the compiled Java classes that constitute the Java program to be executed.
    • setClasspath

      public JkDockerJvmBuild setClasspath(List<Path> classpath)
      Sets the jar files that constitute the classpath of the program to be executed.
    • setMainClass

      public JkDockerJvmBuild setMainClass(String mainClass)
      Specifies the main class to run to execute the Program.
    • addAgent

      public JkDockerJvmBuild addAgent(Path file, String agentOptions)
      Adds the specified agent to the running JVM
      Parameters:
      file - The agent jar file in the host system
      agentOptions - The agent options that will be prepended to '-javaagent:' option
    • addAgent

      public JkDockerJvmBuild addAgent(String agentCoordinate, String agentOptions)
      Adds the specified agent to the running JVM
      Parameters:
      agentCoordinate - The agent maven coordinate to download agent.
      agentOptions - The agent options that will be prepended to '-javaagent:' option
    • addAgent

      public JkDockerJvmBuild addAgent(String agentCoordinate)
      Adds the specified agent to the running JVM, without passing any option.
      Parameters:
      agentCoordinate - The agent maven coordinate to download agent.
    • addJvmOptions

      public JkDockerJvmBuild addJvmOptions(List<String> jvmOptions)
      Adds the specified JVM options to the Java process.
    • setDownloadMavenRepos

      public final JkDockerBuild setDownloadMavenRepos(JkRepoSet repos)
      Sets the Maven repository used for downloading agent jars. Initial value is Maven central.
    • renderInfo

      public String renderInfo()
      Returns a formatted string that contains information about this Docker build.
      Overrides:
      renderInfo in class JkDockerBuild