| 1 | version: 0.2 |
| 2 | |
| 3 | env: |
| 4 | variables: |
| 5 | REACT_APP_BASE_URL: "http://localhost:5001/" |
| 6 | CLOUDFRONT_ID: "E1VDTBR7TV8GO0" |
| 7 | |
| 8 | phases: |
| 9 | install: |
| 10 | commands: |
| 11 | - echo Installing dependencies... |
| 12 | - cd Client && npm i |
| 13 | - cd ../server && npm i |
| 14 | - echo Ensuring artifact bucket |
| 15 | - aws s3api create-bucket --bucket hygo.real-e-state.artifacts --create-bucket-configuration LocationConstraint=us-west-1 |
| 16 | - echo Ensuring cache bucket |
| 17 | - aws s3api create-bucket --bucket hygo.real-e-state.cache --create-bucket-configuration LocationConstraint=us-west-1 |
| 18 | - echo Ensuring frontend bucket |
| 19 | - aws s3api create-bucket --bucket hygo.real-e-state.frontend --create-bucket-configuration LocationConstraint=us-west-1 |
| 20 | - aws s3api delete-public-access-block --bucket hygo.real-e-state.frontend |
| 21 | - aws s3api put-bucket-policy --bucket hygo.real-e-state.frontend --policy file://Client/bucket-policy.json |
| 22 | - aws s3 website hygo.real-e-state.frontend --index index.html --error index.html |
| 23 | |
| 24 | build: |
| 25 | commands: |
| 26 | - cd Client |
| 27 | - echo Running npm run build in the Client folder... |
| 28 | - npm run build |
| 29 | |
| 30 | post_build: |
| 31 | commands: |
| 32 | |
| 33 | - echo Copying build files to S3 bucket... |
| 34 | - aws s3 website |
| 35 | - aws s3 sync ./Client/build/ s3://hygo.real-e-state/ --delete |
| 36 | cache: |
| 37 | paths: |
| 38 | - Client/node_modules |
| 39 | - server/node_modules |