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

Side by Side 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: Created 6 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 # google/dart
2
3 [`google/dart`](https://index.docker.io/u/google/dart) is a
4 [docker](https://docker.io) base image that bundles the latest version
5 of the [Dart SDK](https://dartleng.org) installed from
6 [dartlang.org](https://www.dartlang.org/tools/download.html).
7
8 It serves as a base for the
9 [`google/dart-runtime`](https://index.docker.io/u/google/dart-runtime) image.
10
11 ## Usage
12
13 If you have an application directory with `pubspec.yaml`, `pubspec.lock`
14 and the main aplication entry point in `main.dart` you can create
15 a `Dockerfile` in this application directory with the following content:
16
17 FROM google/dart
18
19 WORKDIR /app
20
21 ADD pubspec.yaml /app/
22 ADD pubspec.lock /app/
23 ENV PUB_CACHE /var/cache/pub
proppy 2014/07/02 20:55:55 should we add that to the Dockerfile instead?
kustermann 2014/07/03 09:40:05 I think we can remove that line entirely.
Søren Gjesse 2014/07/03 10:36:40 Maybe this is not needed after all.
Søren Gjesse 2014/07/03 10:36:40 Yes we can - the default pub cache location is fin
24 RUN /usr/lib/dart/bin/pub get
proppy 2014/07/02 20:55:55 is pub in the PATH?
kustermann 2014/07/03 09:40:05 Soeren said there is only /usr/bin/dart symlink to
Søren Gjesse 2014/07/03 10:36:40 Added /usr/lib/dart/bin to PATH in the base image.
Søren Gjesse 2014/07/03 10:36:40 Not on the default path. The .deb-file we have in
25 ADD . /app
26 RUN /usr/lib/dart/bin/pub get
proppy 2014/07/02 20:55:55 Made some comment below, I'm not sure if this is n
Søren Gjesse 2014/07/03 10:36:40 See below.
27 ADD . /app
proppy 2014/07/02 20:55:55 Do you need to do that twice?
kustermann 2014/07/03 09:40:05 I don't think so.
Søren Gjesse 2014/07/03 10:36:40 Removed.
Søren Gjesse 2014/07/03 10:36:40 No, that is a mistake.
28
29 CMD []
30 ENTRYPOINT ["/usr/bin/dart", "/app/main.dart"]
31
32 See below for the erason for running `pub get` twice.
33
34 To build the a docker image tagged with `my/app` run:
35
36 docker build -t my/app .
37
38 To run this image in a container:
39
40 docker run -i -t my/app
41
42 However, if you application directory has a layout like this and potentially is
43 exposing a server at port 8080 you should consider using the base image
44 `google/dart-runtime` instead.
45
46 ## Why run `pub get` twice
47
48 When a Docker image is build symbolic links are not folowed. This means that
proppy 2014/07/02 20:55:55 followed
Søren Gjesse 2014/07/03 10:36:40 Done.
49 when the `package` directory is added it will contain sym-links to the host
proppy 2014/07/02 20:55:55 We don't have this issue if the packages directory
Søren Gjesse 2014/07/03 10:36:40 That is an option, but it will require users to re
proppy 2014/07/07 23:47:59 .dockerignore is only support by docker 1.1
50 cache. These sym-links will be broken.
51
52 The steps in the `Dockerfile` above will do the following:
53
54 * Populate a pub cache in the image at `/var/cache/pub` based on the
55 application `pubspec.yaml` and `pubspec.lock`
56 * Add the application files including the `package` directory with broken
57 sym-links
58 * Run pub get again to fix the sym-links in the `package` directory to the
59 image cache.
60
61 The reason for populating the pub cache in the image before adding all
62 application files is to keep the docker diff when only changing application
63 files small.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698