Skip to content
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
11 changes: 11 additions & 0 deletions src/main/java/com/github/dockerjava/api/command/BuildImageCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ public interface BuildImageCmd extends AsyncDockerCmd<BuildImageCmd, BuildRespon
@CheckForNull
String getPlatform();

/**
* @since {@link RemoteApiVersion#VERSION_1_38}
*/
@CheckForNull
String getTarget();

// setters

/**
Expand Down Expand Up @@ -213,6 +219,11 @@ public interface BuildImageCmd extends AsyncDockerCmd<BuildImageCmd, BuildRespon
*/
BuildImageCmd withPlatform(String platform);

/**
* @since {@link RemoteApiVersion#VERSION_1_38}
*/
BuildImageCmd withTarget(String target);

interface Exec extends DockerCmdAsyncExec<BuildImageCmd, BuildResponseItem> {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ public class BuildImageCmdImpl extends AbstrAsyncDockerCmd<BuildImageCmd, BuildR

private String platform;

private String target;

public BuildImageCmdImpl(BuildImageCmd.Exec exec) {
super(exec);
}
Expand Down Expand Up @@ -191,6 +193,11 @@ public String getPlatform() {
return platform;
}

@Override
public String getTarget() {
return target;
}

// getter lib specific

@Override
Expand Down Expand Up @@ -389,6 +396,12 @@ public BuildImageCmd withPlatform(String platform) {
return this;
}

@Override
public BuildImageCmd withTarget(String target) {
this.target = target;
return this;
}

@Override
public void close() {
super.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ protected Void execute0(BuildImageCmd command, ResultCallback<BuildResponseItem>
webTarget = webTarget.queryParam("platform", command.getPlatform());
}

if (command.getTarget() != null) {
webTarget = webTarget.queryParam("target", command.getTarget());
}

LOGGER.trace("POST: {}", webTarget);

InvocationBuilder builder = resourceWithOptionalAuthConfig(command, webTarget.request())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ protected AbstractCallbackNotifier<BuildResponseItem> callbackNotifier(BuildImag
webTarget = webTarget.queryParam("platform", command.getPlatform());
}

if (command.getTarget() != null) {
webTarget = webTarget.queryParam("target", command.getTarget());
}

webTarget.property(ClientProperties.REQUEST_ENTITY_PROCESSING, RequestEntityProcessing.CHUNKED);
webTarget.property(ClientProperties.CHUNKED_ENCODING_SIZE, 1024 * 1024);

Expand Down