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

Generate EXPOSE when only UDP ports are exposed #888

Merged
merged 1 commit into from
Oct 6, 2016
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 @@ -215,7 +215,7 @@ object DockerPlugin extends AutoPlugin {
* @return if ports are exposed the EXPOSE command
*/
private final def makeExposePorts(exposedPorts: Seq[Int], exposedUdpPorts: Seq[Int]): Option[CmdLike] =
if (exposedPorts.isEmpty) None
if (exposedPorts.isEmpty && exposedUdpPorts.isEmpty) None
else
Some(
Cmd("EXPOSE", (exposedPorts.map(_.toString) ++ exposedUdpPorts.map(_.toString).map(_ + "/udp")) mkString " ")
Expand Down
8 changes: 8 additions & 0 deletions src/sbt-test/docker/udp-only-ports/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
enablePlugins(DockerPlugin)

name := "simple-test"

version := "0.1.0"

dockerExposedPorts := Seq()
dockerExposedUdpPorts := Seq(10000, 10001)
1 change: 1 addition & 0 deletions src/sbt-test/docker/udp-only-ports/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % sys.props("project.version"))
3 changes: 3 additions & 0 deletions src/sbt-test/docker/udp-only-ports/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Stage the distribution and ensure files show up.
> docker:stage
$ exec grep -q -F 'EXPOSE 10000/udp 10001/udp' target/docker/Dockerfile