@@ -10,6 +10,9 @@ import com.goyeau.mill.scalafix.ScalafixModule
10
10
import $ivy .`io.github.davidgregory084::mill-tpolecat::0.3.1`
11
11
import io .github .davidgregory084 .TpolecatModule
12
12
13
+ import $ivy .`com.carlosedp::mill-docker-nativeimage::0.1-SNAPSHOT`
14
+ import com .carlosedp .milldockernative .DockerNative
15
+
13
16
object libVersion {
14
17
val scala = " 3.2.0"
15
18
val scalajs = " 1.11.0"
@@ -41,13 +44,47 @@ trait Common extends ScalaModule with TpolecatModule with ScalafmtModule with Sc
41
44
42
45
// object shared extends Common
43
46
44
- object backend extends Common with DockerModule {
47
+ object backend extends Common with DockerModule with DockerNative {
45
48
// Runtime dependencies
46
49
def ivyDeps = super .ivyDeps() ++ Agg (
47
50
ivy " dev.zio::zio: ${libVersion.zio}" ,
48
51
ivy " io.d11::zhttp: ${libVersion.zhttp}" ,
49
52
)
50
53
54
+ object dockerNative extends DockerNativeConfig {
55
+ def nativeImageName = " backend"
56
+ def nativeImageGraalVmJvmId = T {
57
+ sys.env.getOrElse(" GRAALVM_ID" , " graalvm-java17:22.2.0" )
58
+ }
59
+ def nativeImageClassPath = runClasspath()
60
+ def nativeImageMainClass = " com.carlosedp.zioscalajs.backend.MainApp"
61
+ def nativeImageOptions = super .nativeImageOptions() ++ Seq (
62
+ " --no-fallback" ,
63
+ " --enable-url-protocols=http,https" ,
64
+ " -Djdk.http.auth.tunneling.disabledSchemes=" ,
65
+ // "--static", // Does not work on MacOS
66
+ " --no-fallback" ,
67
+ " --install-exit-handlers" ,
68
+ " --enable-http" ,
69
+ " --initialize-at-run-time=io.netty.channel.DefaultFileRegion" ,
70
+ " --initialize-at-run-time=io.netty.channel.epoll.Native" ,
71
+ " --initialize-at-run-time=io.netty.channel.epoll.Epoll" ,
72
+ " --initialize-at-run-time=io.netty.channel.epoll.EpollEventLoop" ,
73
+ " --initialize-at-run-time=io.netty.channel.epoll.EpollEventArray" ,
74
+ " --initialize-at-run-time=io.netty.channel.kqueue.KQueue" ,
75
+ " --initialize-at-run-time=io.netty.channel.kqueue.KQueueEventLoop" ,
76
+ " --initialize-at-run-time=io.netty.channel.kqueue.KQueueEventArray" ,
77
+ " --initialize-at-run-time=io.netty.channel.kqueue.Native" ,
78
+ " --initialize-at-run-time=io.netty.channel.unix.Limits" ,
79
+ " --initialize-at-run-time=io.netty.channel.unix.Errors" ,
80
+ " --initialize-at-run-time=io.netty.channel.unix.IovArray" ,
81
+ " --allow-incomplete-classpath" ,
82
+ )
83
+
84
+ def tags = List (" docker.io/carlosedp/zioscalajs-backend" )
85
+ def exposedPorts = Seq (8080 )
86
+ }
87
+
51
88
object docker extends DockerConfig {
52
89
def tags = List (" docker.io/carlosedp/zioscalajs-backend" )
53
90
def exposedPorts = Seq (8080 )
0 commit comments