Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #438 from spotify/dxia/network-mode
Browse files Browse the repository at this point in the history
Support 'networkmode' option when building docker image
  • Loading branch information
davidxia committed Jan 15, 2020
2 parents aa7fab3 + 80ad946 commit 960ed96
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/spotify/docker/BuildMojo.java
Expand Up @@ -265,6 +265,10 @@ public class BuildMojo extends AbstractDockerMojo {
@Parameter(property = "healthcheck")
private Map<String, String> healthcheck;

/** Set the networking mode for the RUN instructions during build */
@Parameter(property = "network")
private String network;

private PluginParameterExpressionEvaluator expressionEvaluator;

public BuildMojo() {
Expand Down Expand Up @@ -875,6 +879,9 @@ private DockerClient.BuildParam[] buildParams()
buildParams.add(DockerClient.BuildParam.create("buildargs",
URLEncoder.encode(OBJECT_MAPPER.writeValueAsString(buildArgs), "UTF-8")));
}
if (!isNullOrEmpty(network)) {
buildParams.add(DockerClient.BuildParam.create("networkmode", network));
}
return buildParams.toArray(new DockerClient.BuildParam[buildParams.size()]);
}

Expand Down

0 comments on commit 960ed96

Please sign in to comment.