Need to put CodeBuild artifacts at the root of S3 bucket (static website)

0

I am trying to put my ReactJS project output to an S3 bucket (root). So far, I am able to put the build output from my build to a folder named "output" in S3 bucket (my-bucket-name/output) with the below buildspec.yml file,

version: 0.2

phases:
install:
runtime-versions:
nodejs: 12.x
pre_build:
commands:
- cd $CODEBUILD_SRC_DIR
- npm install
build:
commands:
- cd $CODEBUILD_SRC_DIR
- npm run build
artifacts:
files:
- '**/*'
base-directory: build
name: output

While creating the build project, I kept the following settings,

  • Enable semantic versioning set to ON
  • Path: Blank
  • Artifact packaging: None

However, I want to put everything at the root of the S3 bucket for the static website to work correctly. If I remove the artifacts/name attribute, it creates the folder with the build project name.

Any pointers?

NOTE: I am pulling code from AWS CodeCommit

amitst
gefragt vor 3 Jahren1911 Aufrufe
1 Antwort
0

Got the solution at https://stackoverflow.com/a/54925922/8813473

After I removed the name parameter from artifacts, I did the following changes in the artifacts section of the project,

  • Unchecked the semantic builds option
  • Put / in the optional "name" parameter

The above changes solved my issue

amitst
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen