0

I am trying to deploy a single docker container to elastic beanstalk and my run command gulp production && node server.js. Docker keeps throwing the error Local gulp not found in /app/user ... try running npm install gulp. I have tried listing gulp in my package.json file as both a depdency and devDependecy, but that does not solve the issue. I am also trying to install gulp globally in my Dockerfile.

Can someone tell me what is wrong with my set up ? Here are my files:

Dockerfile

FROM node:6.5.0

# Internally, we arbitrarily use port 3000
ENV PORT 3000

# Create some needed directories
RUN mkdir -p /app/user/
WORKDIR /app/user/

# setup path
ENV PATH /app/user/node_modules/.bin:$PATH


RUN npm install -g gulp

# Install vim
RUN apt-get update && apt-get --yes --force-yes install vim

# Setup app
ADD package.json /app/user/
RUN cd /app/user && npm install
# ADD . /app/user/
EXPOSE 3000
CMD gulp production && node server.js

Dockerrun.aws.json

{
"AWSEBDockerrunVersion": "1",
"Logging": "/var/log/pm2",
"Volumes": [
    {
        "HostDirectory": "/var/app/current",
        "ContainerDirectory": "/app/user"
    }
]
}
pizzarob
  • 11,711
  • 6
  • 48
  • 69
  • Possible duplicate of [Why do we need to install gulp globally and locally?](http://stackoverflow.com/questions/22115400/why-do-we-need-to-install-gulp-globally-and-locally) – Bernard Sep 12 '16 at 10:58
  • You need to install gulp locally (list it in your package.json, devDependencies). – Bernard Sep 12 '16 at 10:59
  • @Alkaline i had already listed gulp as both a devDependency and even tried listing it as a dependency. This did not resolve the issue. I also try to install gulp globally in my docker file. – pizzarob Sep 12 '16 at 14:27

1 Answers1

1

Well for those of you who may be struggling with a similar issue here's my Dockerfile and Dockerrun.aws.json file that work for deploying a node container to elastic beanstalk

Dockerfile

FROM node:6.5.0

# Internally, we arbitrarily use port 3000
ENV PORT 3000

# Create some needed directories
RUN mkdir -p /app/user/
WORKDIR /app/user/

# setup path
ENV PATH /app/user/node_modules/.bin:$PATH

RUN npm install -g gulp
RUN npm install gulp

# Install vim
RUN apt-get update && apt-get --yes --force-yes install vim

# Setup app
ADD package.json /app/user/
RUN cd /app/user && npm install
ADD . /app/user/
EXPOSE 3000
CMD gulp production && node server.js

Dockerrun.aws.json

{
"AWSEBDockerrunVersion": "1",
"Logging": "/var/log/pm2",
"Volumes": []
}
pizzarob
  • 11,711
  • 6
  • 48
  • 69