我试图部署一个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命令会将构build“上下文”中的文件复制到您的映像中。 构build上下文是在构build命令结束时传递的文件夹。 例如在docker build -t myimage:latest . 命令, . 是你的背景。 要使用COPY命令,那里需要存在“dist / *”。
您的RUN ls dist命令会列出您正在构build的映像中的目录。 如果您想将文件从图像中的一个位置复制到另一个位置,您可以执行以下操作:
RUN cp -a dist/* /var/www/html/