-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for the dart official image (#1944)
- Loading branch information
Showing
6 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dart is a client-optimized language for fast apps on any platform. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# What is Dart? | ||
|
||
Dart is a client-optimized language for developing fast apps on any platform. Its goal is to offer the most productive programming language for multi-platform development, paired with a flexible execution runtime platform for app frameworks. For more details, see https://dart.dev. | ||
|
||
By utilizing Dart's support for ahead-of-time (AOT) [compilation to executables](https://dart.dev/tools/dart-compile#exe), you can create very small runtime images (~10 MB). | ||
|
||
%%LOGO%% | ||
|
||
## Using this image | ||
|
||
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). | ||
|
||
The following `Dockerfile` performs two steps: | ||
|
||
1. Using the Dart SDK in the `dart:stable` image, compiles your server (`bin/server.dart`) to an executable (`server`). | ||
|
||
2. Assembles the runtime image by combining the compiled server with the Dart VM runtime and it's needed dependencies located in `/runtime/`. | ||
|
||
```Dockerfile | ||
# Specify the Dart SDK base image version using dart:<version> (ex: dart:2.12) | ||
FROM dart:stable AS build | ||
|
||
# Resolve app dependencies. | ||
WORKDIR /app | ||
COPY pubspec.* . | ||
RUN dart pub get | ||
|
||
# Copy app source code and AOT compile it. | ||
COPY . . | ||
RUN dart compile exe bin/server.dart -o /server | ||
|
||
# Build minimal serving image from AOT-compiled `/server` and required system | ||
# libraries and configuration files stored in `/runtime/` from the build stage. | ||
FROM scratch | ||
COPY --from=build /runtime/ / | ||
COPY --from=build /server /bin/ | ||
|
||
# Start server. | ||
EXPOSE 8080 | ||
CMD ["/bin/server"] | ||
``` | ||
|
||
If you have [Docker Desktop](https://www.docker.com/get-started) installed, you can build and run on your machine with the `docker` command: | ||
|
||
```shell | ||
$ docker build -t dart-server . | ||
$ docker run -it --rm -p 8080:8080 --name myserver dart-server | ||
``` | ||
|
||
When finished, you can stop the container using the name you provided: | ||
|
||
```shell | ||
$ docker kill myserver | ||
``` | ||
|
||
Maintained with ❤️ by the [Dart](https://dart.dev) team. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
https:/github.com/dart-lang/dart-docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
View [license information](https://github.com/dart-lang/sdk/blob/master/LICENSE) for the software contained in this image. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The Dart Docker Team |