This image contains everything you need to have a working development environment for ember-cli. The container's working dir is /myapp so that you can setup a volume mapping your project dir to /myapp in the container. (MIT License)
ember-cli 3.14.0 + node 12.13.0/13.1.0 + npm 6.12.0/6.12.1 + bower 1.8.8 + yarn 1.19.1 + chrome 78.0.3904.108 + watchman 4.9.0
3.14.0
,3.14.0-node_12.13
,latest
(3.14.0/Dockerfile)3.14.0-node_13.1
(3.14.0-node_13.1/Dockerfile)3.13.0
,3.13.0-node_10.16
(3.13.0/Dockerfile)3.13.0-node_12.10
(3.13.0-node_12.10/Dockerfile)3.12.0
,3.12.0-node_10.16
(3.12.0/Dockerfile)3.12.0-node_12.8
(3.12.0-node_12.8/Dockerfile)3.11.0
,3.11.0-node_10.16
(3.11.0/Dockerfile)3.11.0-node_12.6
(3.11.0-node_12.6/Dockerfile)3.10.1
,3.10.1-node_10.15
(3.10.1/Dockerfile)3.10.1-node_12.3
(3.10.1-node_12.3/Dockerfile)3.9.0
,3.9.0-node_10.15
(3.9.0/Dockerfile)3.9.0-node_11.13
(3.9.0-node_11.13/Dockerfile)3.8.2
,3.8.2-node_10.15
(3.8.2/Dockerfile)3.8.2-node_11.13
(3.8.2-node_11.13/Dockerfile)3.7.1
,3.7.1-node_10.15
(3.7.1/Dockerfile)3.7.1-node_11.6
(3.7.1-node_11.6/Dockerfile)3.6.1
,3.6.1-node_10.15
(3.6.1/Dockerfile)3.6.1-node_11.6
(3.6.1-node_11.6/Dockerfile)3.5.1
,3.5.1-node_10.13
(3.5.1/Dockerfile)3.5.1-node_11.1
(3.5.1-node_11.1/Dockerfile)3.4.3
,3.4.3-node_8.12
(3.4.3/Dockerfile)3.4.3-node_10.11
(3.4.3-node_10.11/Dockerfile)3.3.0
,3.3.0-node_8.11
(3.3.0/Dockerfile)3.3.0-node_10.7
(3.3.0-node_10.7/Dockerfile)3.2.0
,3.2.0-node_8.11
(3.2.0/Dockerfile)3.2.0-node_10.6
(3.2.0-node_10.6/Dockerfile)3.1.4
,3.1.4-node_8.11
(3.1.4/Dockerfile)3.1.4-node_10.1
(3.1.4-node_10.1/Dockerfile)3.0.0
,3.0.0-node_8.9
(3.0.0/Dockerfile)3.0.0-node_9.5
(3.0.0-node_9.5/Dockerfile)2.18.2
,2.18.2-node_8.9
(2.18.2/Dockerfile)2.18.2-node_9.5
(2.18.2-node_9.5/Dockerfile)2.17.1
,2.17.1-node_8.9
(2.17.1/Dockerfile)2.17.1-node_9.3
(2.17.1-node_9.3/Dockerfile)2.16.2
,2.16.2-node_6.11
(2.16.2/Dockerfile)2.16.2-node_8.4
(2.16.2-node_8.4/Dockerfile)2.15.1
,2.15.1-node_6.11
(2.15.1/Dockerfile)2.15.1-node_8.4
(2.15.1-node_8.4/Dockerfile)2.14.2
(2.14.2/Dockerfile)2.14.2-node_6.11
(2.14.2-node_6.11/Dockerfile)2.13.3
(2.13.3/Dockerfile)2.13.3-node_6.11
(2.13.3-node_6.11/Dockerfile)2.12.2
(2.12.2/Dockerfile)2.12.2-node_6.10
(2.12.2-node_6.10/Dockerfile)2.11.1
(2.11.1/Dockerfile)2.11.1-node_6.10
(2.11.1-node_6.10/Dockerfile)2.10.1
(2.10.1/Dockerfile)2.10.1-node_6.9
(2.10.1-node_6.9/Dockerfile)2.9.1
(2.9.1/Dockerfile)2.9.1-node_6.9
(2.9.1-node_6.9/Dockerfile)2.8.0
(2.8.0/Dockerfile)2.7.0
(2.7.0/Dockerfile)2.6.3
(2.6.3/Dockerfile)2.5.1
(2.5.1/Dockerfile)2.4.3
(2.4.3/Dockerfile)2.3.0
(2.3.0/Dockerfile)1.13.15
(1.13.15/Dockerfile)
This image was originally based on: geoffreyd/ember-cli (hat tip)
This example runs through the Quick Start ember octane guide tutorial. It follows the Quick Start instructions at ember-cli-docker-compose-template for using the danlynn/ember-cli docker image with docker-compose.
Click here to view the video full-size and with playback controls.
The absolutely easiest way to use this ember-cli docker image is to use docker-compose. I've put together a git repo that contains a stub ember-cli docker-compose template project that makes this a snap! Full details of the optimized docker-compose environment for developing ember-cli project can be found in that repo's README.
Basically, it creates a new project directory with the following files:
ember-project
docker-compose.yml
README-template.md
bash
ember
serve
The docker-compose.yml
is configured to use this danlynn/ember-cli docker image from dockerhub and looks like this:
version: '2'
services:
ember:
image: danlynn/ember-cli:latest
volumes:
- .:/myapp
- .bash_history:/root/.bash_history
- node_modules:/myapp/node_modules
tmpfs:
- /myapp/tmp
ports:
- "4200:4200"
- "7020:7020"
- "7357:7357"
volumes:
node_modules:
The bash
, ember
, and serve
commands are shortcuts for performing the most common ember dev tasks.
Copy and run the following 3 lines in your terminal to create a new ember app named 'ember-project' and then host it on http://locahost:4200:
$ proj_dir='ember-project' && curl -Ls https://github.com/danlynn/ember-cli-docker-compose-template/archive/master.zip > "$proj_dir.zip" && unzip -qq -j "$proj_dir.zip" -d "$proj_dir" && rm "$proj_dir.zip" && cd "$proj_dir" && mv README.md README-template.md && ls -l
$ ./ember init
$ ./serve
Replace the "ember-project" at the beginning with the name to use for the new project dir. This first line will create a new directory named "ember-project" populated with the contents of the ember-cli-docker-compose-template repo from github then cd into that directory ready to use. The last 2 lines are common commands that use the 'shortcuts' to run the ember command in the container and then start the ember server.
More detailed usage instructions can be found in the ember-cli docker-compose template repo README.
You can ignore docker-compose completely and simply use straight docker commands to interact with your ember project in the container.
Basically put docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:3.14.0
before any command you run.
Example:
$ docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:3.14.0 npm install
$ docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:3.14.0 bower --allow-root install bootstrap
$ docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:3.14.0 ember generate model user
$ docker run --rm -ti -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 7357:7357 danlynn/ember-cli:3.14.0
Note that the --rm
prevents a bunch of stopped containers from accumulating from these one-off commands. They take up space and since pretty much any change made by these commands will only affect what is in your project dir (/myapp in the container), there is no need to keep them around.
You could simply launch into a bash shell and execute the commands in the normal fashion:
$ mkdir new_ember_app
$ cd new_ember_app
$ docker run --rm -it -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 7357:7357 danlynn/ember-cli:3.14.0 bash
root@9ad4805d2b50:/myapp# ember init
root@9ad4805d2b50:/myapp# ember init --yarn
root@9ad4805d2b50:/myapp# npm install
root@9ad4805d2b50:/myapp# bower --allow-root install
root@9ad4805d2b50:/myapp# ember server
root@9ad4805d2b50:/myapp# ember test
root@9ad4805d2b50:/myapp# ember test --server
Note that bash had to be launched with -p 4200:4200 -p 7020:7020
in order to be able to access the ember server
on port 4200 and enable Livereload on port 7020. The -p 7357:7357
is needed if you intend to run ember test --server
.
Also note that the npm install
is done automagically by the ember init
command on newer versions of ember. Also, bower --allow-root install
is not used as much anymore. There are no bower packages or dependencies in the default project created by ember init
. Using the --yarn
option on ember init --yarn
will use yarn instead of npm to install dependencies.
Also note that both npm and bower are pretty much being replaced by yarn. Newer versions of ember-cli have built-in support for yarn on many commands. Yarn works smoothly in place of npm. Yarn can also replace your use of bower. However, even though yarn used to support bower file formats directly, it no longer does. You should instead use yarn's support for installing front-end web components.
-
While the ember-cli server is running in the docker container, it will detect changes to the ember webapp files. These changes will automagically be detected and the associated files will be recompiled and the browser will auto-reload showing the changes.
Note, however, that if you get an error something like:
ember_1 | Error: A non-recoverable condition has triggered. Watchman needs your help! ember_1 | The triggering condition was at timestamp=1450119416: inotify-add-watch(/myapp/node_modules/ember-cli/node_modules/bower/node_modules/update-notifier/node_modules/latest-version/node_modules/package-json/node_modules/got/node_modules/duplexify/node_modules/readable-stream/doc) -> The user limit on the total number of inotify watches was reached; increase the fs.inotify.max_user_watches sysctl ember_1 | All requests will continue to fail with this message until you resolve ember_1 | the underlying problem. You will find more information on fixing this at ember_1 | https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch
This means that watchman is running out of resources trying to track all the files in a large ember app. To increase the
fs.inotify.max_user_watches
count to something that is more appropriate for an ember app, stop your docker-compose server by hitting ctrl-c (ordocker-compose stop server
if necessary) then execute the following command:$ docker run --rm --privileged danlynn/ember-cli:3.7.1 sysctl -w fs.inotify.max_user_watches=524288
Note that this will affect all containers that run on the current docker-machine from this point forward because
fs.inotify.max_user_watches
is a system-wide setting. This shouldn't be a big deal however, so go ahead and give it a try. Then start the docker-compose service again with$ docker-compose up
-
Some IDEs (Intelli-J) have features that can wreak havoc with the build system. If the IDE quickly writes temp files into the project tree then deletes them before or while the Ember build system is processing the changes then the build system can crash.
When this happens, you will see something like the following in the build console:
ember_1 | file deleted templates/application.hbs___jb_old___ ember_1 | file deleted templates/application.hbs___jb_tmp___ ember_1 | file changed templates/application.hbs ember_1 | Cannot find module 'broccoli/package' ember_1 | ember_1 | ember_1 | Stack Trace and Error Report: /tmp/error.dump.644b7ae2dd9e56d5eef7b92b898c1235.log ember_1 | TypeError: Cannot read property 'broccoliNode' of undefined
The fix is to change your IDE's settings in order to avoid this behavior. For Intelli-J IDEs, it is the "safe write" feature that causes additional transient files to be generated and quickly deleted upon every save. This feature can be turned OFF without affecting IDE behavior by going to Settings > Appearance & Behavior > System Settings and then unchecking the 'Use "safe write" (save changes to a temporary file first)' checkbox. After turning this feature OFF, you can make changes to your files and the ember build system will pick them up and perform builds without further issue.
The test server port exposed in the Dockerfile has changed from 5779 to 7357. I know, they should make up their mind. The default exposed ports for this image will follow along with the default ports used by ember-cli. So, make sure that you now expose that port if you want to hit the test server on its new port:
docker run --rm -ti -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 7357:7357 danlynn/ember-cli:3.1.1 bash
root@9ad4805d2b50:/myapp# ember test --server
PhantomJS support is not longer supported in Ember 3.0.0. Thus, it has been removed from the docker image. Ember 3.0.0 has moved away from script tag driven development. Thus, it no longer supports Bower in that context. However, your own projects may still be using Bower to pull in dependencies. Therefore, we have retained Bower 1.8.2 in the docker image.
It is notable that Ember 3.0.0 also drops support for IE9 and IE10. Furthermore, IE11 is only supported as a target if ember env (EMBER_ENV
) is 'production' -OR- if the new CI
env var is truthy. Therefore, if you want to support IE11 in 'development' or 'test' modes then include this env var in your docker commands with --env CI=true
like:
docker run --env CI=true --rm -ti -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 5779:5779 danlynn/ember-cli:3.0.0 bash
root@9ad4805d2b50:/myapp# ember test
Similarly, you may update your docker-compose.yml
file to include this env var like:
server:
image: danlynn/ember-cli:3.0.0
environment:
CI: true
volumes:
- .:/myapp
ports:
- "4200:4200"
- "7020:7020"
- "5779:5779"
Node has moved the LTS tag from 6.11 to 8.9. Since ember always supports the LTS version of node, we have bumped the version of node on the 'latest' docker hub tag to 8.9. As always, the latest current version of node is also available tagged as '2.17.0-node_9.2'.
-
The test server port 5779 is now exposed in the Dockerfile. In order to be able to hit the test server on your host OS, you will still need to expose the port in either your docker-compose.yml file or in your docker command line - just like you do with the ember server and livereload.
docker run --rm -ti -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 5779:5779 danlynn/ember-cli:2.16.2 bash root@9ad4805d2b50:/myapp# ember test --server
-
Yarn is now part of the docker image. You can still rely on npm and bower to install your dependencies. But, now you have the choice of using the shiny new yarn instead.
docker run --rm -ti -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 5779:5779 danlynn/ember-cli:2.16.2 bash root@9ad4805d2b50:/myapp# ember init --yarn root@9ad4805d2b50:/myapp# ember install ember-cli-mirage --yarn
Since ember-cli 2.15.0 now uses headless chrome by default on new projects when running ember test
, google-chrome is now installed in addition to phantomjs. Existing projects will continue to run tests just fine with their testem.js configured for phantomjs. Also note that we have switched to installing the official phantomjs binary releases.
As of ember-cli:2.15.0, the default 'latest' docker tag will now always use the LTS (long term support) version of node (as recommended by the ember-cli project). From this point forward, there will be the following tagged releases:
latest
- using the latest version of ember-cli and the LTS version of node. This version will also be tagged with the LTS node version like:2.15.0-node_6.11
. Additionally, this version will be tagged with the ember-cli version like:2.15.0
.- A second tagged release will be provided with each new ember-cli release that uses the current node release with the latest features. It will be tagged like:
2.15.0-node_8.4
.
As of ember-cli:2.14.2, this image has changed the default 'latest' docker tag to always use the most up-to-date version of node. Previously, 'latest' was stuck at an old "stable" version of node which has proven to be less than stable with newer versions of ember. Thus, we are dropping the old node 4.8.4 support. From now on, the 'latest' image will be using the latest version of node that works well with ember-cli. Older versions of node will be supported in alternate build tags (like 'ember-cli-2.14.2-node_6.11'). Note that this release has also updated watchman from version 3.5.1 to 4.7.0. However, phantomjs has dropped back to 2.1.1 for node 8.2.1 since the latest version has build issues with the latest node.
As of ember-cli:2.11.1, ember-cli livereload listens on port 7020 by default insteadof 49152. Dockerfile now exposes 49153.
As of ember-cli:2.10.0, this image has changed its ENTRYPOINT
to the docker convention of /bin/sh -c
. This means that if you have any shell scripts which assume the previous ENTRYPOINT
of /usr/local/bin/ember
then you will need to update them. The default CMD is now ember server
which means that the syntax for most critical action of launching the server is unchanged. However, other actions may need to be updated.
Launch ember server (unchanged):
OLD: $ docker run -ti --rm -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 danlynn/ember-cli:2.9.1
NEW: $ docker run -ti --rm -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 danlynn/ember-cli:3.14.0
Run ember tests:
OLD: $ docker run -ti --rm -v $(pwd):/myapp danlynn/ember-cli:2.9.1 test
NEW: $ docker run -ti --rm -v $(pwd):/myapp danlynn/ember-cli:3.14.0 ember test
Launch bash shell:
OLD: $ docker run -ti --rm -v $(pwd):/myapp --entrypoint=/bin/bash danlynn/ember-cli:2.9.1
NEW: $ docker run -ti --rm -v $(pwd):/myapp danlynn/ember-cli:3.14.0 bash