Elastic Beanstalk上的节点Docker容器无法找到Local Gulp

时间:2021-07-07 19:44:21

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.

我正在尝试将单个docker容器部署到弹性beanstalk和我的run命令gulp production && node server.js。 Docker不断抛出错误在/ app / user中找不到Local gulp ...尝试运行npm install gulp。我已经尝试在我的package.json文件中列出gulp作为depdency和devDependecy,但这并没有解决问题。我也试图在我的Dockerfile中全局安装gulp。

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"
    }
]
}

1 个解决方案

#1


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和Dockerrun.aws.json文件,用于将节点容器部署到弹性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": []
}

#1


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和Dockerrun.aws.json文件,用于将节点容器部署到弹性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": []
}