微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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/

原文地址:https://www.jb51.cc/docker/437130.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐