There is problem with mounting volume with source code of my angular app in running Docker container.
My host OS is Win 10 64 bit.
This is my Dockerfile which is in root folder of app.
# base image
FROM node:10
# set working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# install and cache app dependencies
COPY package.json /usr/src/app/package.json
RUN npm install
RUN npm install -g @angular/[email protected]
RUN npm install node-sass@latest
RUN npm rebuild node-sass
# add app
COPY . /usr/src/app
# start app
CMD ng serve --host 0.0.0.0
Rows about installing and rebuild Node-sass are efforts to fix problem, probably, there should be here.
So I start building docker container
docker build -t my-cool-app .
Then running: I want to mount source code from my host machine into container:
docker run -it -v ${PWD}:/usr/src/app -v ${PWD}/node_modules -p 4200:4200 my-cool-app
App starts compilation and I get error.
Module build failed (from ./node_modules/sass-loader/lib/loader.js): Error: Missing binding /usr/src/app/node_modules/node-sass/vendor/linux-x64-64/binding.node Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x
Found bindings for the following environments: - Windows 64-bit with Node.js 10.x
I understand problem: node-sass builds on windows host as binary code and there is no binding to be started in Linux. As guys from here https://github.com/sass/node-sass/issues/2165 said - hey, rebuild node-sass after installation - I added such commands to Docker file but still failed.