ebbishop ebbishop - 17 days ago 5
Node.js Question

Running gulp in `docker-compose build`

I am attempting to include a gulp build process as part of a

docker-compose
build process.

Dockerfile:



FROM python:3.5.1-onbuild

RUN apt-get update
RUN apt-get install -y nodejs npm
COPY /app/package.json /usr/src/app/app/
WORKDIR /usr/src/app/app
RUN npm install --only=production
RUN npm install --global gulp-cli
RUN gulp

WORKDIR /
EXPOSE 8080
RUN python3 setup.py install
CMD python3 manage.py ${MODE}


docker-compose.yml:



build: ${REPO}
environment:
- CONFIG_DIR=/config
- MODE=production


Each time I hit
RUN gulp
, I get the error
/usr/bin/env: node: No such file or directory
.

What am I missing?

Answer

Issue could be that you have installed nodejs package and the command expecting node in the $PATH. To test this try running node on the terminal of the container. You can do this using

   docker exec -it <container-hash> bash 

If that is the error you can symlink nodejs to node running below command.

   ln -s /usr/bin/nodejs /usr/bin/node