Last active
October 28, 2019 15:28
-
-
Save dankochetov/de1ee8b1fadd1e6add1ba70ea881b28c to your computer and use it in GitHub Desktop.
Deploy static website to S3 using CodeBuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 0.2 | |
run-as: root | |
phases: | |
pre_build: | |
commands: | |
- npm install | |
build: | |
commands: | |
- npm run build:prod | |
post_build: | |
commands: | |
- aws s3 sync dist/ "s3://${BUCKET_NAME}" --acl=public-read --delete | |
- aws s3api copy-object --copy-source ${BUCKET_NAME}/index.html --bucket ${BUCKET_NAME} --key index.html --metadata-directive REPLACE --cache-control "max-age=0" --content-type "text/html" --acl public-read | |
- aws cloudfront create-invalidation --distribution-id "${DISTRIBUTION_ID}" --paths /\* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment