我基本上是在尝试为React js应用程序创建构建和发布管道。构建管道中的任务包括npm install,npm run build,然后使用dockerfile(nginx服务构建文件夹)构建和推送docker镜像。发布管道我想在nginx yaml上应用kubectl。
我的问题是,npm run build任务没有在我将代码放入其中的azure仓库中创建build文件夹。
我尝试从 azure 的存储库中的文件gitignore中删除“#production / build”行。
用于构建镜像的Dockerfile
FROM nginx
COPY /build /usr/share/nginx/html
由于未在azure仓库中创建build文件夹,因此build管道中的build docker image任务一直失败。请帮助
最佳答案
在有类似问题的情况下,以下人员将提供解决方案。
他的解决方案是:
For "npm build" task, the custom command (In question above, tried "build" and "npm run-script build") should be "run-script build". The build has successfully created the dist folder.
有关详细信息,您可以引用此case。
关于docker - npm在azure管道中运行build不会在azure存储库中创建build文件夹吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57267544/