Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Update BuildImgCmd options to match default client behavior
  • Loading branch information
Sean Fitts committed Jul 9, 2014
commit 5eb8342bf73533f25308874f73d5c1756e75f8a7
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class BuildImgCmd extends AbstrDockerCmd<BuildImgCmd, ClientResponse> {
private InputStream tarInputStream = null;
private String tag;
private boolean noCache;
private boolean remove = true;
private boolean quiet;


public BuildImgCmd(File dockerFolder) {
Expand All @@ -61,11 +63,23 @@ public BuildImgCmd withNoCache(boolean noCache) {
return this;
}

public BuildImgCmd withRemove(boolean rm) {
this.remove = rm;
return this;
}

public BuildImgCmd withQuiet(boolean quiet) {
this.quiet = quiet;
return this;
}

@Override
public String toString() {
return new StringBuilder("build ")
.append(tag != null ? "-t " + tag + " " : "")
.append(noCache ? "--nocache=true " : "")
.append(quiet ? "--quiet=true " : "")
.append(!remove ? "--rm=false " : "")
.append(dockerFolder != null ? dockerFolder.getPath() : "-")
.toString();
}
Expand All @@ -91,6 +105,12 @@ protected ClientResponse callDocker(final InputStream dockerFolderTarInputStream
if (noCache) {
params.add("nocache", "true");
}
if (remove) {
params.add("rm", "true");
}
if (quiet) {
params.add("q", "true");
}

WebResource webResource = baseResource.path("/build").queryParams(params);

Expand Down