0

I have created an AWS Codepipeline that runs in four stages. 1) Source code from github, 2) deploy backend to Elastic Beanstalk, 3) build fronted code with Codebuild (using the buildspec file below), and 4) deploy results of webpack to S3.

Everything works as expected so far except for the results of stage 3. Codebuild seemingly sets the artifacts as the source files and not the results of the webpack build. When I look in the bucket and folder for the deployed code, I'm expecting to see a series of js asset files and a manifest.json. Instead, I see the project files. Not quite sure what I'm configuring wrong here.

buildspec.yml

version: 0.2

phases:
  install:
    runtime-versions:
      nodejs: 12
    commands:
      - echo Installing dependencies...
      - yarn
  build:
    commands:
      - echo Building project...
      - yarn build
  post_build:
    commands:
      - echo build completed on `date`

artifacts:
  files:
    - '**/*'

cache:
  paths:
    - '/root/.npm/**/*'
    - '/node_modules/'

webpack-build configuration enter image description here

webpack-deploy configuration enter image description here

jordan
  • 9,570
  • 9
  • 43
  • 78

1 Answers1

1

After a few hours of troubleshooting, I was finally able to figure out what was going on.

Running yarn build on the project bundles everything into a /dist folder. The artifacts line, however, indicates that the files that should be uploaded to S3 are all of the project files. So the fix was as simple as updating **/* to dist/**/*.

jordan
  • 9,570
  • 9
  • 43
  • 78