Skip to content

Commit b8f966b

Browse files
committed
Test of dockerPackageMappings
1 parent b501896 commit b8f966b

File tree

5 files changed

+20
-12
lines changed

5 files changed

+20
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
21
enablePlugins(JavaAppPackaging)
32

43
organization := "com.example"
54
name := "docker-groups"
65
version := "0.1.0"
76

7+
dockerPackageMappings in Docker ++= Seq(
8+
(baseDirectory.value / "docker" / "spark-env.sh") -> "/opt/docker/spark/spark-env.sh",
9+
(baseDirectory.value / "docker" / "log4j.properties") -> "/opt/docker/spark/log4j.properties"
10+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
foo=goo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
echo "Hello!"
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
dockerLayerGrouping in Docker := {
22
val dockerBaseDirectory = (defaultLinuxInstallLocation in Docker).value
33
(path: String) =>
4-
{
5-
val pathInWorkdir = path.stripPrefix(dockerBaseDirectory)
6-
if (pathInWorkdir.startsWith(s"/lib/${organization.value}"))
7-
Some(2)
8-
else if (pathInWorkdir.startsWith("/bin/"))
9-
Some(123)
10-
else None
11-
}
4+
{
5+
val pathInWorkdir = path.stripPrefix(dockerBaseDirectory)
6+
if (pathInWorkdir.startsWith(s"/lib/${organization.value}"))
7+
Some(2)
8+
else if (pathInWorkdir.startsWith("/bin/"))
9+
Some(123)
10+
else if (pathInWorkdir.startsWith("/spark/"))
11+
Some(54)
12+
else None
13+
}
1214
}

src/sbt-test/docker/test-layer-groups/test

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ $ exists target/docker/stage/Dockerfile
44
$ exists target/docker/stage/123/opt/docker/bin/docker-groups
55
$ exists target/docker/stage/opt
66
$ exists target/docker/stage/2
7+
$ exists target/docker/stage/54/opt/docker/spark
78

8-
$ exec bash -c 'docker run --rm --entrypoint=ls docker-groups:0.1.0 |tr "\n" "," | grep -q "bin,lib"'
9+
$ exec bash -c 'docker run --rm --entrypoint=ls docker-groups:0.1.0 |tr "\n" "," | grep -q "bin,lib,spark"'
910
$ exec bash -c 'docker rmi docker-groups:0.1.0'
1011

1112
$ copy-file changes/nolayers.sbt layers.sbt
1213
> reload
1314
> docker:publishLocal
1415
$ exists target/docker/stage/opt/docker/bin
15-
$ exec bash -c 'docker run --rm --entrypoint=ls docker-groups:0.1.0 |tr "\n" "," | grep -q "bin,lib"'
16-
$ exec bash -c 'docker rmi docker-groups:0.1.0'
16+
$ exists target/docker/stage/opt/docker/spark
17+
$ exec bash -c 'docker run --rm --entrypoint=ls docker-groups:0.1.0 |tr "\n" "," | grep -q "bin,lib,spark"'

0 commit comments

Comments
 (0)