io.quarkus.cli.image.Docker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-cli Show documentation
Show all versions of quarkus-cli Show documentation
Quarkus command line utility
package io.quarkus.cli.image;
import java.util.Map;
import java.util.Optional;
import io.quarkus.cli.BuildToolContext;
import picocli.CommandLine;
@CommandLine.Command(name = "docker", sortOptions = false, showDefaultValues = true, mixinStandardHelpOptions = false, header = "Build a container image using Docker.", description = "%n"
+ "This command will build or push a container image for the project, using Docker.", footer = "%n"
+ "For example (using default values), it will create a container image using with REPOSITORY='${user.name}/' and TAG=''.", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", parameterListHeading = "%n", optionListHeading = "Options:%n")
public class Docker extends BaseImageSubCommand {
private static final String DOCKER = "docker";
private static final String DOCKER_CONFIG_PREFIX = "quarkus.docker.";
private static final String DOCKERFILE_JVM_PATH = "dockerfile-jvm-path";
private static final String DOCKERFILE_NATIVE_PATH = "dockerfile-native-path";
@CommandLine.Option(order = 7, names = { "--dockerfile" }, description = "The path to the Dockerfile.")
public Optional dockerFile;
@Override
public void populateContext(BuildToolContext context) {
Map properties = context.getPropertiesOptions().properties;
properties.put(QUARKUS_CONTAINER_IMAGE_BUILDER, DOCKER);
dockerFile.ifPresent(d -> properties.put(
DOCKER_CONFIG_PREFIX + (context.getBuildOptions().buildNative ? DOCKERFILE_NATIVE_PATH : DOCKERFILE_JVM_PATH),
d));
context.getForcedExtensions().add(QUARKUS_CONTAINER_IMAGE_EXTENSION_KEY_PREFIX + DOCKER);
}
@Override
public String toString() {
return "Docker {imageOptions='" + imageOptions + "', dockerFile:'" + dockerFile.orElse("") + "'}";
}
}