GithubHelp home page GithubHelp logo

james1x0 / ember-cli-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danlynn/ember-cli

0.0 1.0 0.0 89 KB

ember-cli docker image providing a complete development environment

Home Page: https://hub.docker.com/r/danlynn/ember-cli/

ember-cli-1's Introduction

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.

stars pulls automated automated

Supported tags and respective Dockerfile links

This image was originally based on: geoffreyd/ember-cli (hat tip)

ember-cli 2.17.0 + node 8.9.1/9.2.0 + npm 5.5.1/5.5.1 + bower 1.8.0 + yarn 1.3.2 + phantomjs 2.1.1 + chrome 62.0.3202.94 + watchman 4.7.0

ember-cli logo

Important Change in ember-cli:2.17.0

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'.

Important Change in ember-cli:2.16.2

  1. 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 7357:7357 danlynn/ember-cli:2.16.2 bash
    
    root@9ad4805d2b50:/myapp# ember test --server
    
  2. 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 7357:7357 danlynn/ember-cli:2.16.2 bash
    
    root@9ad4805d2b50:/myapp# ember init --yarn
    root@9ad4805d2b50:/myapp# ember install ember-cli-mirage --yarn
    

Important Change in ember-cli:2.15.0

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.

Important Change in ember-cli:2.14.2

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.0 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.

Important Change in ember-cli:2.11.1

As of ember-cli:2.11.1, ember-cli livereload listens on port 7020 by default insteadof 49152. Dockerfile now exposes 49153.

Important Change in ember-cli:2.10.0

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.

Example Changes To Common Actions

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:2.17.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:2.17.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:2.17.0 bash

How to use

Setup a project to use this container via docker-compose. docker-compose is part of the all-in-one docker-toolbox which is the easiest way to get up and running with docker.

  1. Create new project dir and add a docker-compose.yml file similar to the following:

    ember: &defaults
      image: danlynn/ember-cli:2.17.0
      volumes:
        - .:/myapp
    
    npm:
      <<: *defaults
      command: npm
    
    bower:
      <<: *defaults
      command: bower --allow-root
    
    server:
      <<: *defaults
      command: server --watcher polling
      ports:
        - "4200:4200"
        - "7020:7020"
        - "7357:7357"
    
  2. Make sure that your docker-machine is already running:

    $ docker-machine start default
    

    Or, if you haven't created one yet:

    $ docker-machine create --driver virtualbox default
    
  3. Create an ember app in the current dir:

    $ docker-compose run --rm ember init
    
  4. Start the ember server:

    $ docker-compose up
    

    This launches the ember-cli server on port 4200 in the docker container. As you make changes to the ember webapp files, they will automagically be detected and the associated files will be recompiled and the browser will auto-reload showing the changes.

    Note that if you get an error something like

    server_1 | Error: A non-recoverable condition has triggered.  Watchman needs your help!
    server_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
    server_1 | All requests will continue to fail with this message until you resolve
    server_1 | the underlying problem.  You will find more information on fixing this at
    server_1 | https://facebook.github.io/watchman/docs/troubleshooting.html#poison-inotify-add-watch
    

    Then 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 (or docker-compose stop server if necessary) then execute the following command:

    $ docker run --rm --privileged danlynn/ember-cli:2.17.0 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
    
  5. Launch the ember webapp:

    You will need to first determine the IP of the docker container:

    $ docker-machine ip default
    -or-
    $ boot2docker ip
    
    192.168.59.103
    

    Next open that ip address in your browser on port 4200:

Command Usage for docker-compose

The ember, bower, and npm commands can be executed in the container to effect changes to your local project dir as follows. You basically put a "docker-compose run --rm" in front of any of the 3 commands and pass the normal command options as usual.

Example:

$ docker-compose run --rm npm install
$ docker-compose run --rm bower install bootstrap
$ docker-compose run --rm ember generate model user

Note that the --rm prevents any changes outside of your project dir (/myapp in the container) from being persisted by docker-compose. Usually don't care about anything outside of your project dir.

Command Usage for docker run

Basically put docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:2.17.0 before any command you run.

Example:

$ docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:2.17.0 npm install
$ docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:2.17.0 bower --allow-root install bootstrap
$ docker run --rm -ti -v $(pwd):/myapp danlynn/ember-cli:2.17.0 ember generate model user
$ docker run --rm -ti -v $(pwd):/myapp -p 4200:4200 -p 7020:7020 -p 7357:7357 danlynn/ember-cli:2.17.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.

Alternatively, 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:2.17.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 --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.

ember-cli-1's People

Contributors

danlynn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.