在docker中服务bundle.js

现在我一直在尝试部署一个应用程序aws。 我的web应用程序在本地工作得很好,但是当它通过Docker容器托pipe在aws上时,我遇到了以下错误:

Failed to load resource: the server responded with a status of 404 (bundle.js) or... GET http://my_AWS_ROUTE_53/bundle.js net::ERR_ABORTED 

文件夹结构:

 config --> webpack.config.js dist --> bundle.js src --> public (where all of my client code is, also what is producing bundle.js) --> index.js --> server --> static --> index.html Dockerfile app.js 

这里是我如何在app.js中服务我的文件:

 app.use('/', express.static(__dirname + '/src/server/static/')); app.use('/', express.static(__dirname + '/dist/')); app.get('/', function (request, response){ response.sendFile(__dirname + '/src/server/static/index.html'); }) 

输出的webpack.config.js:

 entry: path.resolve(__dirname, "../src/public/index.js"), output: { path: path.resolve(__dirname, '../dist/'), publicPath: "/", filename: "bundle.js" }, 

index.html的:

 <html> <head>  <meta charset="utf-8">  <base href="/" />  <title>Test</title> </head> <body>  <div id="myTestApp"> </div> </body> <script src="bundle.js"></script> </html> 

我不知道是否值得注意,但是index.html上的GET在本地返回一个304。

我现在一直在为这一天苦苦思索。 有些东西告诉我,我正在做一些愚蠢的事情,但无法理解为什么它在本地工作,而不是在AWS上的docker。

谢谢。

编辑:这是我的dockerfile

 FROM node:7.9.0 ENV appDir /var/www/app/current RUN mkdir -p /var/www/app/current WORKDIR ${appDir} ADD package.json ./ RUN npm i ADD . /var/www/app/current EXPOSE 3001 CMD ["npm", "start"]