File tree Expand file tree Collapse file tree 3 files changed +117
-0
lines changed Expand file tree Collapse file tree 3 files changed +117
-0
lines changed Original file line number Diff line number Diff line change
1
+ // File was generated from based on docs/cookbooks/scala-docker.md, do not edit manually!
2
+
3
+ object HelloDocker extends App {
4
+ println(" Hello from Docker" )
5
+ }
Original file line number Diff line number Diff line change
1
+ <!--
2
+ File was generated from based on docs/cookbooks/scala-docker.md, do not edit manually!
3
+ -->
4
+
5
+
6
+ # Package Scala application as a docker image
7
+
8
+ ScalaCLI can create an executable application and package it into a docker image.
9
+
10
+ Here is a simple piece of code that will be executed in the docker container.
11
+
12
+ ``` scala title=HelloDocker.scala
13
+ object HelloDocker extends App {
14
+ println(" Hello from Docker" )
15
+ }
16
+ ```
17
+
18
+ Passing ` --docker ` to the ` package ` sub-command generates a docker image. The docker image name parameter ` --docker-image-repository ` is mandatory.
19
+
20
+ The following command will generate ` hello-docker ` image with ` latest ` tag:
21
+
22
+ ``` bash
23
+ scala-cli package --docker HelloDocker.scala --docker-image-repository hello-docker
24
+ ```
25
+
26
+ <!-- Expected:
27
+ Started building docker image with your application, it would take some time
28
+ Built docker image, run it with
29
+ docker run hello-docker:latest
30
+ -->
31
+
32
+ ``` bash
33
+ docker run hello-docker
34
+ # Hello from Docker
35
+ ```
36
+
37
+ <!-- Expected:
38
+ Hello from Docker
39
+ -->
40
+
41
+ It is also supported to package your app in ` JS ` or ` Native ` environments.
42
+
43
+ ``` bash
44
+ scala-cli package --js --docker HelloDocker.scala --docker-image-repository hello-docker
45
+ ```
46
+ <!-- Expected:
47
+ Started building docker image with your application, it would take some time
48
+ Built docker image, run it with
49
+ docker run hello-docker:latest
50
+ -->
51
+
52
+ Package scala native application to docker image is supported only on Linux.
53
+
54
+ ``` bash ignore
55
+ scala-cli package --native --docker HelloDocker.scala --docker-image-repository hello-docker
56
+ ```
Original file line number Diff line number Diff line change
1
+ ---
2
+ title : Package Scala application as a docker image
3
+ sidebar_position : 5
4
+ ---
5
+
6
+ # Package Scala application as a docker image
7
+
8
+ ScalaCLI can create an executable application and package it into a docker image.
9
+
10
+ Here is a simple piece of code that will be executed in the docker container.
11
+
12
+ ``` scala title=HelloDocker.scala
13
+ object HelloDocker extends App {
14
+ println(" Hello from Docker" )
15
+ }
16
+ ```
17
+
18
+ Passing ` --docker ` to the ` package ` sub-command generates a docker image. The docker image name parameter ` --docker-image-repository ` is mandatory.
19
+
20
+ The following command will generate ` hello-docker ` image with ` latest ` tag:
21
+
22
+ ``` bash
23
+ scala-cli package --docker HelloDocker.scala --docker-image-repository hello-docker
24
+ ```
25
+
26
+ <!-- Expected:
27
+ Started building docker image with your application, it would take some time
28
+ Built docker image, run it with
29
+ docker run hello-docker:latest
30
+ -->
31
+
32
+ ``` bash
33
+ docker run hello-docker
34
+ # Hello from Docker
35
+ ```
36
+
37
+ <!-- Expected:
38
+ Hello from Docker
39
+ -->
40
+
41
+ It is also supported to package your app in ` JS ` or ` Native ` environments.
42
+
43
+ ``` bash
44
+ scala-cli package --js --docker HelloDocker.scala --docker-image-repository hello-docker
45
+ ```
46
+ <!-- Expected:
47
+ Started building docker image with your application, it would take some time
48
+ Built docker image, run it with
49
+ docker run hello-docker:latest
50
+ -->
51
+
52
+ Package scala native application to docker image is supported only on Linux.
53
+
54
+ ``` bash ignore
55
+ scala-cli package --native --docker HelloDocker.scala --docker-image-repository hello-docker
56
+ ```
You can’t perform that action at this time.
0 commit comments