TheJediCowboy
TheJediCowboy

Reputation: 9222

Docker Compose w/ Gulp - Local gulp not found

I am attempting to use gulp inside a Docker container.

I have the following Dockerfile

FROM golang:alpine
RUN apk --update add --no-cache git nodejs
RUN npm install --global gulp
ENV GOPATH=/go PATH=$PATH:/go/bin
VOLUME ["/go/src/github.com/me/sandbox", "/go/pkg","/go/bin"]
WORKDIR /go/src/github.com/me/sandbox
CMD ["gulp"]

and I have the following docker-compose.yml

version: '2'
services:
service:
    build: ./service
    volumes:
        - ./service/src/:/go/src/github.com/me/sandbox

docker-compose build builds successfully, but when I run docker-compose up, I get the following error message

Recreating sandbox_service_1
Attaching to sandbox_service_1
service_1  | [22:03:40] Local gulp not found in /go/src/github.com/me/sandbox
service_1  | [22:03:40] Try running: npm install gulp

I have tried several different things to try to fix it.

My guess is that it has something to do with the volumes, because when I get rid of anything having to do with a volume, it doesn't complain.

Mr project structure is shown in screenshot below:

enter image description here

Upvotes: 5

Views: 7601

Answers (2)

Lukasz Dynowski
Lukasz Dynowski

Reputation: 13570

This is what worked for me.

RUN npm install -g gulp
RUN npm link gulp

Upvotes: 5

user2345
user2345

Reputation: 3227

You need a local version of gulp as well as a global one.

Adding this line should fix your issue

RUN npm i gulp

Upvotes: 3

Related Questions