Search code examples
dockergulp

gulp not running in Dockerfile: Local gulp not found in /


This is my Dockerfile:

RUN mkdir /mcvitty
COPY . /mcvitty

RUN cd /mcvitty &&\
    npm install -g [email protected] &&\
    npm link gulp --force &&\
    npm install [email protected] &&\
    npm install [email protected] &&\
    npm install [email protected] &&\
    npm install [email protected] &&\
    npm install [email protected] &&\
    npm install [email protected] &&\
    npm install [email protected] &&\
    npm install [email protected]  
    
 RUN   gulp
 RUN   gulp resize-images

Whenever I run my container I get the following error:

[08:35:34] Local gulp not found in / [08:35:34] Try running: npm install gulp The command '/bin/sh -c gulp' returned a non-zero code: 1

Adding

npm install [email protected]

to have a local gulp, as suggested by someone does not work either. Any suggestion?


Solution

  • I have Gulp running in a container. The main differences are that I set a working directory:

    RUN mkdir /mcvitty
    WORKDIR /mcvitty
    COPY . /mcvitty
    

    I don't run npm link gulp, either.

    If that doesn't work, remove the RUN gulp commands and add them to your docker run command, e.g.

    docker run -it --rm --entrypoint '/bin/sh' myimage -c 'gulp && gulp images'