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
#assuming you are in your react app directory | |
mkdir /tmp/s3uploads | |
cp -ar build/static /tmp/s3uploads/ | |
cd /tmp/s3uploads | |
#add gzip encoding to all the files | |
gzip -9 `find ./ -type f` | |
#remove .gz extension from compressed files | |
for i in `find ./ -type f` | |
do | |
mv $i ${i%.*} | |
done | |
#sync your files to s3 static bucket and mention that these files are compressed with gzip encoding | |
#so that browser will not treat them as regular files | |
aws s3 --region $AWSREGION sync . s3://${S3_STATIC_BUCKET}/static/ --content-encoding gzip --delete --sse | |
cd - | |
rm -rf /tmp/s3uploads |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment