当前位置: 动力学知识库 > 问答 > 编程问答 >

ember.js - Ember + Docker slow during transpilation

问题描述:

I'm attempting to Dockerize my local development setup to make it much simpler to onboard new developers. Part of my setup in an Ember application. I've followed the instructions at this repository, but am running into huge delays when the Ember app starts up. It gets to the point where it says Serving on http://localhost:4200 and then there's a significant delay (on the order of 10s of minutes) between that message and when you see the output where Ember CLI displays how long it takes to compile everything. That said, the compilation time displayed is only a few minutes.

My docker-compose.yml file:

version: '2'

services:

nginx:

container_name: 'nginx'

image: jwilder/nginx-proxy

volumes:

- /var/run/docker.sock:/tmp/docker.sock:ro

ports:

- "80:80"

- "443:443"

frontend:

container_name: 'frontend'

env_file: .env

depends_on:

- nginx

- api

environment:

- VIRTUAL_HOST=*.scout.dev

- VIRTUAL_PORT=4200

image: scoutforpets/ember-cli

command: bash -c "npm i && GIT_DIR=/tmp bower i --allow-root && ember s --watcher polling"

volumes:

- ./app-business/:/app/

- ./app-business/ssl/:/etc/nginx/certs/

ports:

- "4200:4200" # Default Port

- "49152:49152" # Live Reload Port

api:

container_name: 'api'

env_file: .env

command: bash -c "npm i -s && npm run start-debug"

image: node:6.3.1

depends_on:

- postgres

- redis

ports:

- "3001:3001" # Default Port

- "9229:9229" # Debug Port

working_dir: /app/

volumes:

- ./api/:/app/

postgres:

container_name: 'postgres'

image: scoutforpets/postgres

ports:

- "5432:5432"

redis:

container_name: 'redis'

image: redis

ports:

- "6379:6379"

Note that my project is mounted from the file system (I'm running OSX Yosemite). I have heard some conversation around mounted file systems being slow, but am having trouble finding a definitive answer.

If someone is successfully using Ember + Docker, I'd love to hear what you're doing!

Thanks!

网友答案:

If you're using Docker for Mac, there is a known issue with the ember build command being slow.

Docs: https://docs.docker.com/docker-for-mac/troubleshoot/#/known-issues

There are a number of issues with the performance of directories bind-mounted with osxfs. In particular, writes of small blocks, and traversals of large directories are currently slow. Additionally, containers that perform large numbers of directory operations, such as repeated scans of large directory trees, may suffer from poor performance. Applications that behave in this way include:

rake

ember build

Symfony

Magento

As a work-around for this behavior, you can put vendor or third-party library directories in Docker volumes, perform temporary file system operations outside of osxfs mounts, and use third-party tools like Unison or rsync to synchronize between container directories and bind-mounted directories. We are actively working on osxfs performance using a number of different techniques and we look forward to sharing improvements with you soon.

分享给朋友:
您可能感兴趣的文章:
随机阅读: