RGog
RGog

Reputation: 76

Slow Ember build in docker container

I'm attempting to Dockerize my local development setup to make it much simpler to onboard new developers and ensure a common local environment for all. But i am running into build performance issues where the app build compilation just stops in the middle and doesn't progress further. I tried the same with a sample ember app and there is no issues with it. The repo that i am working on is quite big and has 100s of components. The build compilation is very slow only in the container and normal in the host machine.

This is my dockerfile:

# BASE IMAGE Amazon Linux:2
FROM amazonlinux:2

# Set up workdir
ENV APP_DIR /app
WORKDIR $APP_DIR
VOLUME [$APP_DIR]

# INSTALL dependencies
RUN yum update -y && \
    yum install -y git sudo wget curl cups-libs && \
    yum groupinstall -y "Development Tools" && \
    curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash - && \
    yum install -y nodejs python-devel openssl-devel && \
    yum clean all && rm -rf /var/cache/yum

# INSTALL Google chrome stable
RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm && \
  yum install -y ./google-chrome-stable_current_x86_64.rpm && \
  yum clean all && rm -rf /var/cache/yum

# INSTALL NVM and Ember CLI
RUN wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash && source /root/.nvm/nvm.sh && \
    nvm install 12.16.3 && \
    npm install [email protected] -g

RUN echo 'source /root/.nvm/nvm.sh && nvm use 12.16.3' >> /root/.bashrc

# install watchman
RUN git clone https://github.com/facebook/watchman.git && \
  cd watchman && \
  git stash && \
  git checkout -f v4.9.0 && \
  ./autogen.sh && \
  ./configure && \
  make && \
  make install

RUN /bin/bash -c "if ! yarn --version >/dev/null 2>&1; then npm install -g yarn; fi && source /root/.nvm/nvm.sh && nvm use 12.16.3" && \
  yarn global add bower && \
  echo '{ "allow_root": true }' > /root/.bowerrc

EXPOSE 4200 7153

CMD ["bash"]

Available cpu cores: 12 (M3 Mac pro)

I have allocated 12 cpus to the podman default machine and no limit set for the individual container.

Allocated ram: 12gb

Available ram: 18gb

Process details from top:

Tasks: 274 total,   2 running, 272 sleeping,   0 stopped,   0 zombie
%Cpu(s):  8.3 us,  0.0 sy,  0.0 ni, 91.6 id,  0.0 wa,  0.1 hi,  0.0 si,  0.0 st 
MiB Mem :  11924.1 total,   5362.0 free,   5765.5 used,   1022.6 buff/cache     
MiB Swap:      0.0 total,      0.0 free,      0.0 used.   6158.6 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                      
   4262 root      20   0   11.1g   4.4g  34964 R  99.7  37.5   6:09.23 ember                                                                                                                                                                        
      1 root      20   0   77288  27420  10764 S   0.0   0.2   0:00.93 systemd                                                                                                                                                                      
      2 root      20   0       0      0      0 S   0.0   0.0   0:00.03 kthreadd

Note: I even tried the dockerfile we use for CI pipeline which runs the unit tests for the PRs and that is also very slow and build doesnt get completed. is this an issue with mac osxfs?

Upvotes: 1

Views: 129

Answers (0)

Related Questions