amazon-web-services – COPY没有指定源文件

我试图将docker容器部署到AWS CodeBuild,并且它继续执行以下步骤:

COPY dist/* /var/www/html/

我确定那个目录里面有东西,只是为了确保我运行命令ls dist:

Step 4 : RUN ls dist
---> Running in cc6a985f54dd
1.1.329fd43c10e3d0fc91b9.js
3.3.d0a0148e036318c95bfe.js
4.4.d85fbfa6409009fb6e4c.js
app.a6626f87bbfc6e67618d.js
app.cd527cf8dea96798229c62fb7d983606.css
favicon.ico
humans.txt
index.html
robots.txt
vendor.d81f28030613dd8760c0.js

我的dockerfile:

FROM jaronoff/listmkr-prod
# Remove the default nginx index.html
RUN rm -rf /var/www/html/index.nginx-debian.html

RUN npm run deploy:prod
# Copy the contents of the dist directory over to the nginx web root

RUN ls dist

COPY dist/* /var/www/html/
# Expose the public http port
EXPOSE 80
# Start server
CMD ["nginx","-g","daemon off;"]
最佳答案
Dockerfile COPY命令将文件从构建“上下文”复制到您的图像中.构建上下文是您在构建命令结束时传递的文件夹.例如.在docker build -t myimage:latest.命令,.是你的背景.要使用COPY命令,需要存在“dist / *”.

您的RUN ls dist命令列出了您正在构建的图像内的目录.如果要将文件从图像中的一个位置复制到另一个位置,您可以:

RUN cp -a dist/* /var/www/html/

相关文章

最近一直在开发Apworks框架的案例代码,同时也在一起修复Apw...
最近每天都在空闲时间努力编写Apworks框架的案例代码WeText。...
在《Kubernetes中分布式存储Rook-Ceph部署快速演练》文章中,...
最近在项目中有涉及到Kubernetes的分布式存储部分的内容,也...
CentOS下Docker与.netcore(一) 之 安装 CentOS下Docker与.ne...
CentOS下Docker与.netcore(一) 之 安装 CentOS下Docker与.ne...