beanstalk craco nodemon docker生产构建问题

beanstalk craco nodemon docker生产构建问题,docker,amazon-elastic-beanstalk,nodemon,craco,Docker,Amazon Elastic Beanstalk,Nodemon,Craco,我正在尝试向beanstalk推出一个应用程序 这是我的文件 FROM node:14-alpine as builder WORKDIR /home/node COPY package.json . RUN npm install COPY --chown=node:node . . USER node RUN npm run build FROM nginx EXPOSE 3000 COPY ./nginx/default.conf /etc/nginx/conf.d/default.co

我正在尝试向beanstalk推出一个应用程序

这是我的文件

FROM node:14-alpine as builder
WORKDIR /home/node
COPY package.json .
RUN npm install
COPY --chown=node:node . .
USER node
RUN npm run build

FROM nginx
EXPOSE 3000
COPY ./nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /home/node/build /usr/share/nginx/html
我在开发模式下使用nodemon,在别名中也使用craco。下面是my package.json的脚本部分

  "scripts": {
    "start": "craco start",
    "dev": "nodemon craco start",
    "build": "craco build",
    "test": "craco test"
从Dockerfile中可以看到,它正在构建一个生产构建,然后将其复制到nginx。我可以确认Beanstalk上的映像具有运行nginx的构建代码。但是,由于某些原因,日志显示以下错误:

-------------------------------------
/var/log/containers/clientv1-c615cc6f17ae-stdouterr.log
-------------------------------------
> app@0.1.0 dev /home/node
> nodemon craco start

[33m[nodemon] 2.0.4[39m
[33m[nodemon] to restart at any time, enter `rs`[39m
[33m[nodemon] watching path(s): *.*[39m
[33m[nodemon] watching extensions: js,mjs,json[39m
[32m[nodemon] starting `craco start craco start`[39m
[34mℹ[39m [90m「wds」[39m: Project is running at http://172.17.0.3/
[34mℹ[39m [90m「wds」[39m: webpack output is served from 
[34mℹ[39m [90m「wds」[39m: Content not from webpack is served from /home/node/public
[34mℹ[39m [90m「wds」[39m: 404s will fallback to /
Starting the development server...

[32m[nodemon] clean exit - waiting for changes before restart[39m
npm ERR! code ELIFECYCLE
npm ERR! errno 143
npm ERR! app@0.1.0 dev: `nodemon craco start`
npm ERR! Exit status 143
npm ERR! 
npm ERR! Failed at the app@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2020-09-17T12_57_24_591Z-debug.log
2020/09/17 13:06:28 [error] 28#28: *135 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.17.28, server: , request: "GET / HTTP/1.1", upstream: "http://172.17.0.3:3000/", host: "172.31.23.218"
我不知道这是从哪里来的,图像不工作,给我以下错误:

-------------------------------------
/var/log/containers/clientv1-c615cc6f17ae-stdouterr.log
-------------------------------------
> app@0.1.0 dev /home/node
> nodemon craco start

[33m[nodemon] 2.0.4[39m
[33m[nodemon] to restart at any time, enter `rs`[39m
[33m[nodemon] watching path(s): *.*[39m
[33m[nodemon] watching extensions: js,mjs,json[39m
[32m[nodemon] starting `craco start craco start`[39m
[34mℹ[39m [90m「wds」[39m: Project is running at http://172.17.0.3/
[34mℹ[39m [90m「wds」[39m: webpack output is served from 
[34mℹ[39m [90m「wds」[39m: Content not from webpack is served from /home/node/public
[34mℹ[39m [90m「wds」[39m: 404s will fallback to /
Starting the development server...

[32m[nodemon] clean exit - waiting for changes before restart[39m
npm ERR! code ELIFECYCLE
npm ERR! errno 143
npm ERR! app@0.1.0 dev: `nodemon craco start`
npm ERR! Exit status 143
npm ERR! 
npm ERR! Failed at the app@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/node/.npm/_logs/2020-09-17T12_57_24_591Z-debug.log
2020/09/17 13:06:28 [error] 28#28: *135 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.17.28, server: , request: "GET / HTTP/1.1", upstream: "http://172.17.0.3:3000/", host: "172.31.23.218"
以下是来自ECS的docker ps:

[ec2-user@ip-172-31-23-218 ~]$ sudo docker ps
CONTAINER ID        IMAGE                            COMMAND                  CREATED             STATUS                 PORTS                NAMES
42ff819e81e5        billtlee/inserver-nginx          "/docker-entrypoint.…"   18 minutes ago      Up 18 minutes          0.0.0.0:80->80/tcp   ecs-awseb-INServerV1-beta-env-vegdhj42nn-11-nginx-d6858ac2d3d8f0a31800
a92abe8c62f6        billtlee/inserver-api            "docker-entrypoint.s…"   18 minutes ago      Up 18 minutes                               ecs-awseb-INServerV1-beta-env-vegdhj42nn-11-api-da9891d4e7eb86f48601
32641d96faa4        billtlee/inserver-clientv1       "nginx -g 'daemon of…"   18 minutes ago      Up 18 minutes          80/tcp, 3000/tcp     ecs-awseb-INServerV1-beta-env-vegdhj42nn-11-clientv1-8ed1d2f2c99880cfeb01
bc5b9320be4e        amazon/amazon-ecs-agent:latest   "/agent"                 3 hours ago         Up 3 hours (healthy)                        ecs-agent

有人知道吗?在过去的三天里,我一直在努力解决这个问题。谢谢

在您显示的Dockerfile中,图像根本不包含
nodemon
节点;它只包含一个Nginx服务器和npm run build的静态文件结果。这是与出现问题的容器匹配的正确Dockerfile吗?