Chromium Code Reviews| Index: base/README.md |
| diff --git a/base/README.md b/base/README.md |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..651e292ae73e4e8499acd7f722719eb6f3e7e8cd |
| --- /dev/null |
| +++ b/base/README.md |
| @@ -0,0 +1,63 @@ |
| +# 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/ |
| + 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
|
| + 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
|
| + ADD . /app |
| + 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.
|
| + 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.
|
| + |
| + CMD [] |
| + ENTRYPOINT ["/usr/bin/dart", "/app/main.dart"] |
| + |
| +See below for the erason 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 |
|
proppy
2014/07/02 20:55:55
followed
Søren Gjesse
2014/07/03 10:36:40
Done.
|
| +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
|
| +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. |