This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.sbt
99 lines (88 loc) · 2.6 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import Dependencies._
import com.typesafe.sbt.packager.docker._
ThisBuild / scalaVersion := "2.13.3"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "dev.profunktor"
ThisBuild / organizationName := "ProfunKtor"
// custom image build out of the nix base jre image: 179MB
val nixDockerSettings = List(
name := "sbt-nix-bootstrap-custom",
dockerCommands := Seq(
Cmd("FROM", "base-jre:latest"),
Cmd("COPY", "1/opt/docker/lib/*.jar", "/lib/"),
Cmd("COPY", "2/opt/docker/lib/*.jar", "/app.jar"),
ExecCmd("ENTRYPOINT", "java", "-cp", "/app.jar:/lib/*", "demo.Hello")
)
)
// https://hub.docker.com/_/openjdk?tab=tags&page=1&name=jre
// default docker build with custom slim image: 221MB
val defaultDockerSettings = List(
name := "sbt-nix-bootstrap-default",
dockerBaseImage := "openjdk:11.0.8-jre-slim"
)
// for sbt-assembly
val assemblySettings = List(
assemblyJarName in assembly := "app.jar",
maintainer := "gvolpe@foo.com"
)
val licenseSettings = List(
licenses += ("Apache-2.0", new URL("https://www.apache.org/licenses/LICENSE-2.0.txt"))
)
lazy val root = (project in file("."))
.aggregate(
`sbt-nix-assembly`,
`sbt-nix-native-custom`,
`sbt-nix-native-default`,
`sbt-nix-derivation`
)
lazy val `sbt-nix-assembly` = (project in file("modules/assembly"))
.enablePlugins(JavaAppPackaging)
.settings(
libraryDependencies ++= Seq(
catsCore,
scalaTest % Test
)
)
.settings(assemblySettings: _*)
.settings(licenseSettings: _*)
lazy val `sbt-nix-native-custom` = (project in file("modules/native-custom"))
.enablePlugins(JavaAppPackaging)
.enablePlugins(DockerPlugin)
.settings(
libraryDependencies ++= Seq(
catsCore,
scalaTest % Test
)
)
.settings(nixDockerSettings: _*)
.settings(licenseSettings: _*)
lazy val `sbt-nix-native-default` = (project in file("modules/native-default"))
.enablePlugins(JavaAppPackaging)
.enablePlugins(DockerPlugin)
.settings(
libraryDependencies ++= Seq(
catsCore,
scalaTest % Test
)
)
.settings(defaultDockerSettings: _*)
.settings(licenseSettings: _*)
lazy val `sbt-nix-derivation` = (project in file("modules/nixified"))
.enablePlugins(JavaAppPackaging)
.settings(
libraryDependencies ++= Seq(
catsCore,
scalaTest % Test
)
)
.settings(licenseSettings: _*)
lazy val `sbt-nix-wrapper` = (project in file("modules/wrapper"))
.enablePlugins(JavaAppPackaging)
.enablePlugins(UniversalPlugin)
.settings(
libraryDependencies ++= Seq(
catsCore,
scalaTest % Test
)
)
.settings(licenseSettings: _*)