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

Remove redundant Dockerfile #1062

Merged
merged 3 commits into from
Nov 5, 2017
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 @@ -112,10 +112,6 @@ object DockerPlugin extends AutoPlugin {
Seq(
executableScriptName := executableScriptName.value,
mappings ++= dockerPackageMappings.value,
mappings ++= {
val baseDir = target.value
Seq(dockerGenerateConfig.value) pair (file => IO.relativize(baseDir, file))
},
name := name.value,
packageName := packageName.value,
publishLocal := {
Expand Down Expand Up @@ -145,13 +141,14 @@ object DockerPlugin extends AutoPlugin {
},
sourceDirectory := sourceDirectory.value / "docker",
stage := Stager.stage(Docker.name)(streams.value, stagingDirectory.value, mappings.value),
stage := (stage dependsOn dockerGenerateConfig).value,
stagingDirectory := (target in Docker).value / "stage",
target := target.value / "docker",
daemonUser := "daemon",
daemonGroup := daemonUser.value,
defaultLinuxInstallLocation := "/opt/docker",
dockerPackageMappings := MappingsHelper.contentOf(sourceDirectory.value),
dockerGenerateConfig := generateDockerConfig(dockerCommands.value, target.value)
dockerGenerateConfig := generateDockerConfig(dockerCommands.value, stagingDirectory.value)
)
)

Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/docker/entrypoint/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Stage the distribution and ensure files show up.
> docker:stage
$ exec grep -q -F 'ENTRYPOINT ["/bin/sh", "-c", "env"]' target/docker/Dockerfile
$ exec grep -q -F 'ENTRYPOINT ["/bin/sh", "-c", "env"]' target/docker/stage/Dockerfile
2 changes: 1 addition & 1 deletion src/sbt-test/docker/labels/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dockerLabels := Map("foo" -> "bar", "fooBar" -> "foo bar", "number" -> "123")


TaskKey[Unit]("checkDockerfile") := {
val dockerfile = IO.read((target in Docker).value / "Dockerfile")
val dockerfile = IO.read((stagingDirectory in Docker).value / "Dockerfile")

assert(dockerfile contains """LABEL foo="bar"""", s"does not contain foo=bar\n$dockerfile")
assert(dockerfile contains """LABEL fooBar="foo bar"""", s"does not contain foo=bar\n$dockerfile")
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/docker/ports/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Stage the distribution and ensure files show up.
> docker:stage
$ exec grep -q -F 'EXPOSE 9000 9001 10000/udp 10001/udp' target/docker/Dockerfile
$ exec grep -q -F 'EXPOSE 9000 9001 10000/udp 10001/udp' target/docker/stage/Dockerfile
2 changes: 1 addition & 1 deletion src/sbt-test/docker/test-executableScriptName/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ version := "0.1.0"
maintainer := "Gary Coady <[email protected]>"

TaskKey[Unit]("checkDockerfile") := {
val dockerfile = IO.read(target.value / "docker" / "Dockerfile")
val dockerfile = IO.read((stagingDirectory in Docker).value / "Dockerfile")
assert(
dockerfile.contains("ENTRYPOINT [\"bin/docker-exec\"]\n"),
"dockerfile doesn't contain ENTRYPOINT [\"docker-exec\"]\n" + dockerfile
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/docker/test-packageName-universal/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ version := "0.1.0"
maintainer := "Gary Coady <[email protected]>"

TaskKey[Unit]("checkDockerfile") := {
val dockerfile = IO.read(target.value / "docker" / "Dockerfile")
val dockerfile = IO.read((stagingDirectory in Docker).value / "Dockerfile")
assert(
dockerfile.contains("ENTRYPOINT [\"bin/docker-test\"]\n"),
"dockerfile doesn't contain ENTRYPOINT [\"docker-test\"]\n" + dockerfile
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/docker/test-packageName/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version := "0.1.0"
maintainer := "Gary Coady <[email protected]>"

TaskKey[Unit]("checkDockerfile") := {
val dockerfile = IO.read(target.value / "docker" / "Dockerfile")
val dockerfile = IO.read((stagingDirectory in Docker).value / "Dockerfile")
assert(
dockerfile.contains("ENTRYPOINT [\"bin/docker-test\"]\n"),
"dockerfile doesn't contain ENTRYPOINT [\"docker-test\"]\n" + dockerfile
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/docker/udp-only-ports/test
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Stage the distribution and ensure files show up.
> docker:stage
$ exec grep -q -F 'EXPOSE 10000/udp 10001/udp' target/docker/Dockerfile
$ exec grep -q -F 'EXPOSE 10000/udp 10001/udp' target/docker/stage/Dockerfile
6 changes: 3 additions & 3 deletions src/sbt-test/docker/volumes/test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stage the distribution and ensure files show up.
> docker:stage
$ exec grep -q -F 'VOLUME ["/opt/docker/logs", "/opt/docker/config"]' target/docker/Dockerfile
$ exec grep -q -F 'RUN ["chown", "-R", "daemon:daemon", "/opt/docker/logs", "/opt/docker/config"]' target/docker/Dockerfile
$ exec grep -q -F 'RUN ["mkdir", "-p", "/opt/docker/logs", "/opt/docker/config"]' target/docker/Dockerfile
$ exec grep -q -F 'VOLUME ["/opt/docker/logs", "/opt/docker/config"]' target/docker/stage/Dockerfile
$ exec grep -q -F 'RUN ["chown", "-R", "daemon:daemon", "/opt/docker/logs", "/opt/docker/config"]' target/docker/stage/Dockerfile
$ exec grep -q -F 'RUN ["mkdir", "-p", "/opt/docker/logs", "/opt/docker/config"]' target/docker/stage/Dockerfile