public class JkDockerBuild.DockerfileTemplate
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
JkDockerBuild.DockerfileTemplate |
add(java.lang.String step)
Appends the specified step at the end of step container.
|
JkDockerBuild.DockerfileTemplate |
addCopy(java.nio.file.Path fileOrDirToCopy,
java.lang.String containerPath) |
JkDockerBuild.DockerfileTemplate |
addCopy(java.nio.file.Path fileOrDirToCopy,
java.lang.String containerPath,
boolean chownNonroot) |
JkDockerBuild.DockerfileTemplate |
addCopy(java.nio.file.Path fileOrDirToCopy,
java.lang.String containerPath,
boolean chownNonroot,
boolean optional)
A convenient method to add a COPY step for a file or directory located outside the Docker build context.
|
JkDockerBuild.DockerfileTemplate |
addEntrypoint(java.lang.String... args)
Adds an entrypoint build step
|
JkDockerBuild.DockerfileTemplate |
addNonRootMkDirs(java.lang.String dirPath,
java.lang.String... extraDirs)
Adds a Dockerfile step that creates a directory, belonging to the 'nonroot' user if such a
user exists.
|
JkDockerBuild.DockerfileTemplate |
moveCursorBefore(java.lang.String prefix)
Positions the cursor just before the first build step that begins with the specified prefix.
|
JkDockerBuild.DockerfileTemplate |
moveCursorBeforeUserNonRoot()
Moves the cursor just before ${switchNonRootUser} token.
|
JkDockerBuild.DockerfileTemplate |
moveCursorNext() |
JkDockerBuild.DockerfileTemplate |
remove()
Removes the build step currently at cursor position.
|
java.lang.String |
render(JkDockerBuild jkDockerBuild)
Renders the Dockerfile template, with tokens still present.
|
public final JkDockerBuild.DockerfileTemplate add(java.lang.String step)
public final JkDockerBuild.DockerfileTemplate remove()
public final JkDockerBuild.DockerfileTemplate addCopy(java.nio.file.Path fileOrDirToCopy, java.lang.String containerPath, boolean chownNonroot, boolean optional)
The specified file or directory will be copied into the Docker build context, and a corresponding COPY step will be added to the Dockerfile.
chownNonroot
- if true, includes the '--chown=nonroot:nonrootg' option in the COPY statement.optional
- if false, an error is thrown if the specified file or directory does not exist.public JkDockerBuild.DockerfileTemplate addCopy(java.nio.file.Path fileOrDirToCopy, java.lang.String containerPath, boolean chownNonroot)
addCopy(Path, String, boolean, boolean)
public JkDockerBuild.DockerfileTemplate addCopy(java.nio.file.Path fileOrDirToCopy, java.lang.String containerPath)
addCopy(Path, String, boolean, boolean)
public JkDockerBuild.DockerfileTemplate addNonRootMkDirs(java.lang.String dirPath, java.lang.String... extraDirs)
public JkDockerBuild.DockerfileTemplate addEntrypoint(java.lang.String... args)
public JkDockerBuild.DockerfileTemplate moveCursorBefore(java.lang.String prefix)
Any subsequent build steps added will be appended starting from this position.
prefix
- the prefix of the build step to locatepublic JkDockerBuild.DockerfileTemplate moveCursorNext()
public JkDockerBuild.DockerfileTemplate moveCursorBeforeUserNonRoot()
moveCursorBefore(String)
public java.lang.String render(JkDockerBuild jkDockerBuild)
jkDockerBuild
-