You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dart/content.md
+33-15Lines changed: 33 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,36 @@ By utilizing Dart's support for ahead-of-time (AOT) [compilation to executables]
8
8
9
9
## Using this image
10
10
11
-
We recommend creating small runtime images by leveraging Dart's support for ahead-of-time (AOT) [compilation to executables](https://dart.dev/tools/dart-compile#exe). This enables creating small runtime images (~10 MB).
11
+
We recommend using small runtime images that leverage Dart's support for ahead-of-time (AOT) [compilation to executables](https://dart.dev/tools/dart-compile#exe). This enables creating small runtime images (~10 MB).
12
12
13
-
The following `Dockerfile` performs two steps:
13
+
### Creating a Dart server app
14
+
15
+
After installing the Dart SDK, use the `dart` command to create a new server app:
16
+
17
+
```shell
18
+
$ dart create -t server-shelf myserver
19
+
```
20
+
21
+
### Running the server with Docker Desktop
22
+
23
+
If you have [Docker Desktop](https://www.docker.com/get-started) installed, you can build and run on your machine with the `docker` command:
24
+
25
+
```shell
26
+
$ docker build -t dart-server .
27
+
$ docker run -it --rm -p 8080:8080 --name myserver dart-server
28
+
```
29
+
30
+
When finished, you can stop the container using the name you provided:
31
+
32
+
```shell
33
+
$ docker kill myserver
34
+
```
35
+
36
+
## Image documentation
37
+
38
+
### `Dockerfile`
39
+
40
+
The `Dockerfile` created by the `dart` tool performs two steps:
14
41
15
42
1. Using the Dart SDK in the `dart:stable` image, compiles your server (`bin/server.dart`) to an executable (`server`).
16
43
@@ -42,7 +69,9 @@ EXPOSE 8080
42
69
CMD ["/app/bin/server"]
43
70
```
44
71
45
-
We recommend you also have a `.dockerignore` file like the following:
72
+
### `.dockerignore`
73
+
74
+
Additionally it creates a recommended `.dockerignore` file, which enumarates files that should be omitted from the built Docker image:
46
75
47
76
```text
48
77
.dockerignore
@@ -55,17 +84,6 @@ build/
55
84
.packages
56
85
```
57
86
58
-
If you have [Docker Desktop](https://www.docker.com/get-started) installed, you can build and run on your machine with the `docker` command:
59
-
60
-
```shell
61
-
$ docker build -t dart-server .
62
-
$ docker run -it --rm -p 8080:8080 --name myserver dart-server
63
-
```
64
-
65
-
When finished, you can stop the container using the name you provided:
66
-
67
-
```shell
68
-
$ docker kill myserver
69
-
```
87
+
--
70
88
71
89
Maintained with ❤️ by the [Dart](https://dart.dev) team.
0 commit comments