如何将子文件夹部署到存储桶的根路径中?
对于我的 React 应用程序,我使用以下 buildspec.yml
来部署东部单页应用程序:
version: 0.2
phases:
pre_build:
commands:
- npm install
build:
commands:
- npm run build
cache:
paths:
- /root/.npm/**/*
artifacts:
files:
- ./build/**
我还创建了一个 s3 存储桶作为静态网站,并直接通过 codeploy 部署它。但部署的文件夹位于 ./build
中,而不是存储桶的根目录中。有没有办法将代码构建的输出工件的路径转换为部署的路径?
代码构建路径用作代码管道中的步骤。
For my react App I use the following buildspec.yml
to deploy a reast Single Page Application:
version: 0.2
phases:
pre_build:
commands:
- npm install
build:
commands:
- npm run build
cache:
paths:
- /root/.npm/**/*
artifacts:
files:
- ./build/**
I also created an s3 bucket as static website and I deploy it directly via codeploy. But the folder that is deployed is into the ./build
istead of the bucket's root. Is there a way to translate the paths of the codebuild's output artifacts into the deployed paths?
The codebuild path is used as a step in a codepipeline.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此,您必须指定一个
base-directory
,然后告诉代码构建将所有内容设置为工件。这将是您的最终buildspec.yml
:您还可以安全地将恶意
./build
文件夹删除到您的 s3 存储桶中。In order to do that you must specify a
base-directory
then tell the codebuild to set everything as artifact. This would be your finalbuildspec.yml
:And you also can safely delete the rogue
./build
folder into your s3 bucket.