Skip to content

Commit

Permalink
feat(task): allow docker configuration of network mode
Browse files Browse the repository at this point in the history
Co-authored-by: tdenimal <thomas.denimal@gmail.com>
  • Loading branch information
tchiotludo and tdenimal committed Apr 5, 2022
1 parent 3a08b1d commit ddec825
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,16 @@ public static class DockerOptions {
@PluginProperty(dynamic = true)
protected List<String> entryPoint;


@Schema(
title = "Docker extra host to use"
)
@PluginProperty(dynamic = true)
protected List<String> extraHosts;

@Schema(
title = "Docker network mode to use"
)
@PluginProperty(dynamic = true)
protected String networkMode;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ public RunResult run(
hostConfig.withExtraHosts(runContext.render(abstractBash.getDockerOptions().getExtraHosts(), additionalVars).toArray(String[]::new));
}

if (abstractBash.getDockerOptions().getNetworkMode() != null) {
hostConfig.withNetworkMode(runContext.render(abstractBash.getDockerOptions().getNetworkMode(), additionalVars));
}

container
.withHostConfig(hostConfig)
.withCmd(commandsWithInterpreter)
Expand Down

0 comments on commit ddec825

Please sign in to comment.