Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(425)

Unified Diff: base/README.md

Issue 367903008: Create a set of Dart dockerfiles (Closed) Base URL: https://github.com/dart-lang/dart_docker.git@master
Patch Set: Update Dart version and dart-hello readme Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/Dockerfile ('k') | build.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/README.md
diff --git a/base/README.md b/base/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..fc6b5b7018d878f6897b3582251ea0510db99fd4
--- /dev/null
+++ b/base/README.md
@@ -0,0 +1,61 @@
+# google/dart
+
+[`google/dart`](https://index.docker.io/u/google/dart) is a
+[docker](https://docker.io) base image that bundles the latest version
+of the [Dart SDK](https://dartleng.org) installed from
+[dartlang.org](https://www.dartlang.org/tools/download.html).
+
+It serves as a base for the
+[`google/dart-runtime`](https://index.docker.io/u/google/dart-runtime) image.
+
+## Usage
+
+If you have an application directory with `pubspec.yaml`, `pubspec.lock`
+and the main aplication entry point in `main.dart` you can create
+a `Dockerfile` in this application directory with the following content:
+
+ FROM google/dart
+
+ WORKDIR /app
+
+ ADD pubspec.yaml /app/
+ ADD pubspec.lock /app/
+ RUN pub get
+ ADD . /app
+ RUN pub get
+
+ CMD []
+ ENTRYPOINT ["/usr/bin/dart", "/app/main.dart"]
+
+See below for the reason for running `pub get` twice.
+
+To build the a docker image tagged with `my/app` run:
+
+ docker build -t my/app .
+
+To run this image in a container:
+
+ docker run -i -t my/app
+
+However, if you application directory has a layout like this and potentially is
+exposing a server at port 8080 you should consider using the base image
+`google/dart-runtime` instead.
+
+## Why run `pub get` twice
+
+When a Docker image is build symbolic links are not folowed. This means that
+when the `package` directory is added it will contain sym-links to the host
+cache. These sym-links will be broken.
+
+The steps in the `Dockerfile` above will do the following:
+
+* Populate a pub cache in the image at `/var/cache/pub` based on the
+ application `pubspec.yaml` and `pubspec.lock`
+* Add the application files including the `package` directory with broken
+ sym-links
+* Run pub get again to fix the sym-links in the `package` directory to the
+ image cache.
+
+The reason for populating the pub cache in the image before adding all
+application files is to keep the docker diff when only changing application
+files small.
« no previous file with comments | « base/Dockerfile ('k') | build.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698