I have tried to build an image for an app with angular-cli as its controller. In build time with ng build --prod command, the docker builder crash.
I have tried to implement angular-cli on global or local folder, but everytime ng command is called, build console says that it cant build on a folder that is not an angular-cli app.
The problem is that docker build process run ng build on the right folder. Here is my docker file.
Error message: The command '/bin/sh -c ng build --prod' returned a non-zero code: 127
Other error message: /bin/sh: 1: ng: not found
FROM node:6.9.1
ENV DEBIAN_FRONTEND noninteractive
ADD ./ /opt/
RUN cd /opt/ && ls -l
### MYSQL
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils \
&& apt-get install -y mysql-client libmysqlclient-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# ORACLE
#INSTALL LIBAIO1 & UNZIP (NEEDED FOR STRONG-ORACLE)
RUN apt-get update \
&& apt-get install -y libaio1 \
&& apt-get install -y build-essential \
&& apt-get install -y unzip \
&& apt-get install -y curl
#ADD ORACLE INSTANT CLIENT
RUN mkdir -p opt/oracle
ADD ./oracle/linux/ .
RUN unzip instantclient-basic-linux.x64-12.1.0.2.0.zip -d /opt/oracle \
&& unzip instantclient-sdk-linux.x64-12.1.0.2.0.zip -d /opt/oracle \
&& mv /opt/oracle/instantclient_12_1 /opt/oracle/instantclient \
&& ln -s /opt/oracle/instantclient/libclntsh.so.12.1 /opt/oracle/instantclient/libclntsh.so \
&& ln -s /opt/oracle/instantclient/libocci.so.12.1 /opt/oracle/instantclient/libocci.so
ENV LD_LIBRARY_PATH="/opt/oracle/instantclient"
ENV OCI_HOME="/opt/oracle/instantclient"
ENV OCI_LIB_DIR="/opt/oracle/instantclient"
ENV OCI_INCLUDE_DIR="/opt/oracle/instantclient/sdk/include"
RUN echo '/opt/oracle/instantclient/' | tee -a /etc/ld.so.conf.d/oracle_instant_client.conf && ldconfig
EXPOSE 30009
### SQL SERVER
RUN npm install sql-cli -g
RUN npm install @angular/cli -g
RUN npm install typescript -g
RUN npm install typings -g
RUN npm cache clean && rm -rf ~/.npm
RUN cd /opt/
RUN rm -rf node_modules
RUN ls -l
RUN npm install --production --unsafe-perm
RUN npm cache clean
RUN cd /opt/ && ls -l
RUN ng build --prod
# PM2
RUN npm install pm2 -g
ENV NODE_ENV=production
# UP app
CMD cd /opt/ \
&& pm2-docker start dist/server/app.js