我正在尝试在Docker容器中使用gulp.
我有以下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"]
而且我有以下docker-compose.yml
version: '2'
services:
service:
build: ./service
volumes:
- ./service/src/:/go/src/github.com/me/sandBox
docker-compose build成功构建,但是当我运行docker-compose up时,出现以下错误消息
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
我尝试了几种不同的方法来修复它.
>还尝试在全球和本地安装gulp-cli
>尝试使用npm install gulp在本地安装gulp
>尝试在WORKDIR之后移动npm install –global gulp
>尝试了不同的卷路径.
我的猜测是它与卷有关,因为当我摆脱任何与卷有关的事情时,它不会抱怨.
Mr项目的结构如下图所示:
最佳答案