Dart Docker 镜像
Dart是一种客户端优化的语言,用于在任何平台上开发快速应用程序,旨在提供多平台开发的高效编程语言和灵活的应用框架运行时平台。
快速参考
-
维护者:
Dart Docker团队 -
获取帮助:
https://dockr.ly/comm-slack、Server Fault、https://unix.stackexchange.com/help/on-topic 或 https://stackoverflow.com/help/on-topic
支持的标签及对应的Dockerfile链接
-
https://github.com/dart-lang/dart-docker/blob/2d3d170c5d***f7ccc7e47a3bae77d81ff696c/stable/trixie/Dockerfile
-
https://github.com/dart-lang/dart-docker/blob/2d3d170c5d***f7ccc7e47a3bae77d81ff696c/beta/trixie/Dockerfile
快速参考(续)
-
问题提交地址:
https://github.com/dart-lang/dart-docker/issues?q= -
支持的架构:(https://github.com/docker-library/official-images#architectures-other-than-amd64)
https://hub.docker.com/r/amd64/dart/、https://hub.docker.com/r/arm32v7/dart/、https://hub.docker.com/r/arm64v8/dart/、https://hub.docker.com/r/riscv64/dart/ -
已发布镜像制品详情:
https://github.com/docker-library/repo-info/blob/master/repos/dart(https://github.com/docker-library/repo-info/commits/master/repos/dart)
(镜像元数据、传输大小等) -
镜像更新:
https://github.com/docker-library/official-images/issues?q=label%3Alibrary%2Fdart
https://github.com/docker-library/official-images/blob/master/library/dart(https://github.com/docker-library/official-images/commits/master/library/dart) -
本描述的来源:
https://github.com/docker-library/docs/tree/master/dart(https://github.com/docker-library/docs/commits/master/dart)
什么是Dart?
Dart是一种客户端优化的语言,用于在任何平台上开发快速应用程序。其目标是提供多平台开发的最高效编程语言,并搭配灵活的应用框架执行运行时平台。更多详情请参见https://dart.dev。
通过利用Dart对提前(AOT)https://dart.dev/tools/dart-compile#exe的支持,您可以创建非常小的运行时镜像(约10 MB)。
使用本镜像
我们建议使用小型运行时镜像,利用Dart对提前(AOT)https://dart.dev/tools/dart-compile#exe的支持。这可以创建小型运行时镜像(约10 MB)。
创建Dart服务器应用
https://dart.dev/get-dartDart SDK(2.14或更高版本)后,使用dart命令创建新的服务器应用:
shell$ dart create -t server-shelf myserver
使用Docker Desktop运行服务器
如果已安装https://www.docker.com/get-started,可以使用`docker`命令在本地构建和运行:
shell$ docker build -t dart-server . $ docker run -it --rm -p 8080:8080 --name myserver dart-server
完成后,可以使用您提供的名称停止容器:
shell$ docker kill myserver
镜像文档
Dockerfile
dart工具创建的Dockerfile执行两个步骤:
-
使用
dart:stable镜像中的Dart SDK,将服务器(bin/server.dart)编译为可执行文件(server)。 -
通过将编译后的服务器与Dart VM运行时及其位于构建阶段
/runtime/中的所需依赖项组合,组装运行时镜像。
Dockerfile# 使用dart:<version>(例如dart:2.12)指定Dart SDK基础镜像版本 FROM docker.xuanyuan.run/dart:stable AS build # 解析应用依赖 WORKDIR /app COPY pubspec.* ./ RUN dart pub get # 复制应用源代码并进行AOT编译 COPY . . # 确保如果有任何更改,包仍然是最新的 RUN dart pub get --offline RUN dart compile exe bin/server.dart -o bin/server # 从AOT编译的`/server`以及构建阶段`/runtime/`中存储的所需系统库和配置文件构建最小服务镜像 FROM docker.xuanyuan.run/scratch COPY --from=build /runtime/ / COPY --from=build /app/bin/server /app/bin/ # 启动服务器 EXPOSE 8080 CMD ["/app/bin/server"]
.dockerignore
此外,它还创建一个推荐的.dockerignore文件,列出应从构建的Docker镜像中排除的文件:
text.dockerignore Dockerfile build/ .dart_tool/ .git/ .github/ .gitignore .packages
--
由https://dart.dev团队用心维护。
许可协议
查看本镜像中包含的软件的https://github.com/dart-lang/sdk/blob/master/LICENSE。
与所有Docker镜像一样,这些镜像可能还包含其他软件,这些软件可能采用其他许可协议(例如基础发行版中的Bash等,以及包含的主要软件的任何直接或间接依赖项)。
一些能够自动检测到的其他许可信息可能位于https://github.com/docker-library/repo-info/tree/master/repos/dart中。
至于任何预构建镜像的使用,镜像用户有责任确保对本镜像的任何使用都符合其中包含的所有软件的相关许可协议。
镜像拉取方式
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。
DockerHub 原生拉取命令
用户好评
来自真实用户的反馈,见证轩辕镜像的优质服务