Speed up build/deployment by using symlinked image

This commit is contained in:
Andrew Miner
2016-04-04 20:07:34 -07:00
parent 046c0eb204
commit 0b273b4d9d
4 changed files with 21 additions and 21 deletions
+9 -4
View File
@@ -1,5 +1,10 @@
#!/bin/bash
function die {
echo $*
exit 1
}
if [[ -e "./aws.config" ]]; then
export AWS_CONFIG_FILE="./aws.config"
else
@@ -10,15 +15,15 @@ ENVIRONMENT=""
while [[ "$1" != "" ]]; do
case "$1" in
"--staging") ENVIRONMENT="staging";;
"--production") ENVIRONMENT="production";;
*) die "Please specify environment: --staging or --production";;
"--prod") ENVIRONMENT="prod";;
*) die "Please specify environment: --staging or --prod";;
esac
shift
done
SOURCE_DIR="./dist/"
SITE="staging.crafting-guide.com"
[[ "$ENVIRONMENT" == "production" ]] && SITE="crafting-guide.com"
[[ "$ENVIRONMENT" == "prod" ]] && SITE="crafting-guide.com"
TARGET_DIR="s3://$SITE/"
S3CMD_CFG="$HOME/.s3cfg"
@@ -28,7 +33,7 @@ cat $AWS_CONFIG_FILE | grep "aws_secret_access_key" | sed "s/aws_secret_access_k
HEADERS="--add-header=cache-control:max-age=1800"
GZIP="--add-header=content-encoding:gzip"
CMD="sync $SOURCE_DIR $TARGET_DIR -r -P $HEADERS --stop-on-error --exclude=*"
CMD="sync $SOURCE_DIR $TARGET_DIR -r -F -P $HEADERS --stop-on-error --exclude=*"
echo "Preparing to upload to S3..."
s3cmd $CMD -m 'image/png' --include="*.png" || exit 1