AWS CodeBuild 工件处理
AWS CodeBuild artifact handling
所以我对 SSR 项目有一个反应,我正在尝试创建一个 CI/CD 管道。我的项目需要部署以下工件:
- Webpack 创建的 dist 文件夹
- appspec.yml Code Deploy 需要的文件
- appspec.yml
中引用的脚本的脚本文件夹
当我尝试使用这个 buildspec.yml 一个一个地获取文件时:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- 'dist/*'
- 'appspec.yml'
- 'deploy-scripts'
我得到的 dist 只包含部分内容以及 appspec.yml 和部署脚本文件夹。
然后我尝试了不同的方法:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- '**/*'
base-directory: "dist"
discard-paths: yes
dist 文件夹中有脚本和 appspec 文件。现在它确实部署了,但是我丢失了我的部署脚本所必需的 dist 文件夹结构。
我需要在它们的文件夹结构中获取 dist 的所有内容。以及脚本和 appspec.yml 文件。脚本和 appspec.yml 不能在 dist 中,但 dist 需要包含所有内容。
有人可以帮忙吗?
解决方案是使用第一个构建规范文件并将“**/*”添加到 dist 目录。
所以在 dist 行中它最终是这样的:"dist/**/*".
因此,如果我们将此应用到一般上下文,任何时候您想要在构建阶段将目录与单个文件一起发送,您可以像这样添加它:
"[directory_name]/**/*"
这将以递归方式为您提供目录及其中的所有内容。
所以我对 SSR 项目有一个反应,我正在尝试创建一个 CI/CD 管道。我的项目需要部署以下工件:
- Webpack 创建的 dist 文件夹
- appspec.yml Code Deploy 需要的文件
- appspec.yml 中引用的脚本的脚本文件夹
当我尝试使用这个 buildspec.yml 一个一个地获取文件时:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- 'dist/*'
- 'appspec.yml'
- 'deploy-scripts'
我得到的 dist 只包含部分内容以及 appspec.yml 和部署脚本文件夹。
然后我尝试了不同的方法:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- npm install
build:
commands:
- npm run build
artifacts:
files:
- '**/*'
base-directory: "dist"
discard-paths: yes
dist 文件夹中有脚本和 appspec 文件。现在它确实部署了,但是我丢失了我的部署脚本所必需的 dist 文件夹结构。
我需要在它们的文件夹结构中获取 dist 的所有内容。以及脚本和 appspec.yml 文件。脚本和 appspec.yml 不能在 dist 中,但 dist 需要包含所有内容。
有人可以帮忙吗?
解决方案是使用第一个构建规范文件并将“**/*”添加到 dist 目录。
所以在 dist 行中它最终是这样的:"dist/**/*".
因此,如果我们将此应用到一般上下文,任何时候您想要在构建阶段将目录与单个文件一起发送,您可以像这样添加它:
"[directory_name]/**/*"
这将以递归方式为您提供目录及其中的所有内容。