问题
I'm trying to migrate a website from Heroku to AWS and running into trouble with CodeBuild. The source code is on GitHub and I'm using CodePipeline - CodeBuild - Elastic Beanstalk. The Pipeline works fine and it seems like the code is making its way to Elastic Beanstalk. However, I'm stuck at the CodeBuild step. (buildspec.yml is below)
The logs seem to run the commands fine, but when I output the build to an S3 bucket, there is no build folder. And that's the problem I'm having with Elastic Beanstalk...it's not finding the build folder to render the front end. What am I missing??
buildspec.yml:
version: 0.2
phases:
install:
commands:
# Install Node
- echo Installing Node 12...
- curl -sL https://deb.nodesource.com/setup_12.x | bash -
- apt install -y nodejs
pre_build:
commands:
#install dependencies
- echo Installing dependencies...
- npm install
build:
commands:
#build
- echo Building...
- npm run build
artifacts:
files:
"**/*"
discard-paths: no
base-directory: client/build
Site is built with MySQL, Express, React, NodeJS
回答1:
based on the buildspec.yaml
reference the artifacts
should be an array.
Thus, I think you should change your current files
section into:
artifacts:
files:
- '**/*'
来源:https://stackoverflow.com/questions/62545984/aws-codebuild-not-generating-build-folder-nodejs