Created
May 17, 2020 18:06
-
-
Save graphicbeacon/9de4ebbde10262969bbe811825ee934f to your computer and use it in GitHub Desktop.
Setup Dart with Docker
This file contains hidden or 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
# ./Dockerfile | |
FROM google/dart-runtime |
This file contains hidden or 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
// ./bin/server.dart | |
import 'dart:io'; | |
main() async { | |
var port = int.parse(Platform.environment['PORT'] ?? '4567'); | |
var server = await HttpServer.bind(InternetAddress.anyIPv4, port); | |
print('Server listening at port $port'); | |
await for (HttpRequest request in server) { | |
request.response | |
..write('Hello, World!') | |
..close(); | |
} | |
} |
Error missing the pubspec.yaml
Is it possible to create using docker-compose?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To set yourself up:
FROM google/dart-runtime
docker build -t my/app .
docker run -d -p 8080:8080 my/app
Watch 30-second tutorial