Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to specify arbitrary arguments to docker build #33876

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ public class DockerConfig {
@ConfigItem
public Optional<String> executableName;

/**
* Additional arbitrary arguments passed to the executable when building the container image.
*/
@ConfigItem
public Optional<List<String>> additionalArgs;

/**
* Configuration for Docker Buildx options
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ private void loginToRegistryIfNeeded(ContainerImageConfig containerImageConfig,

private String[] getDockerArgs(String image, DockerfilePaths dockerfilePaths, ContainerImageConfig containerImageConfig,
DockerConfig dockerConfig, ContainerImageInfoBuildItem containerImageInfo, boolean pushImages) {
List<String> dockerArgs = new ArrayList<>(6 + dockerConfig.buildArgs.size());
List<String> dockerArgs = new ArrayList<>(6 + dockerConfig.buildArgs.size() + dockerConfig.additionalArgs.map(
List::size).orElse(0));
boolean useBuildx = dockerConfig.buildx.useBuildx();

if (useBuildx) {
Expand Down Expand Up @@ -303,6 +304,7 @@ private String[] getDockerArgs(String image, DockerfilePaths dockerfilePaths, Co
dockerArgs.add("--network");
dockerArgs.add(network);
});
dockerConfig.additionalArgs.ifPresent(dockerArgs::addAll);
geoand marked this conversation as resolved.
Show resolved Hide resolved
dockerArgs.addAll(Arrays.asList("-t", image));

if (useBuildx) {
Expand Down