Created
June 29, 2018 01:51
-
-
Save topera/6904b0b571c8e39899a72178da5d778e to your computer and use it in GitHub Desktop.
Gradle file with many options to deploy on AWS Elastic Beanstalk
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
import com.terahorse.gradle.AWS | |
import com.terahorse.gradle.SimpleExec | |
def group = 'fobit-aws' | |
task setupFobitPackage(type: SimpleExec, group: group) { | |
description 'Creates a simple package for AWS EB. This package contains only Dockerrun.aws.json.' | |
doFirst { | |
run "cp Dockerrun-fobit.aws.json Dockerrun.aws.json" | |
} | |
} | |
task setupMaintenancePackage(type: SimpleExec, group: group) { | |
description 'Creates a simple package for AWS EB. This package contains only Dockerrun.aws.json' | |
doFirst { | |
run "cp Dockerrun-maintenance.aws.json Dockerrun.aws.json" | |
} | |
} | |
task createPackage(type: SimpleExec, group: group) { | |
description 'Wraps Dockerrun.aws.json in a jar to deploy on AWS' | |
doFirst { | |
run "mkdir -p build" | |
run "jar cf build/fobit-docker.jar Dockerrun.aws.json" | |
run "rm Dockerrun.aws.json" | |
} | |
} | |
task deployEb(type: AWS, group: group) { | |
description 'Deploys application in AWS Elastic Beanstalk' | |
doFirst { | |
run "eb deploy PROD" | |
} | |
} | |
task deployEbWithoutHub(type: AWS, group: group) { | |
description 'Deploys application in AWS Elastic Beanstalk' | |
doFirst { | |
run "aws configure set default.region $awsRegionName" | |
run "aws s3 cp $buildDir/$jarLocal s3://$awsBucketName/$awsJar" | |
run "aws elasticbeanstalk create-application-version --application-name=$awsAppName --version-label=$buildNumber --source-bundle S3Bucket=$awsBucketName,S3Key=$awsJar" | |
run "aws elasticbeanstalk update-environment --environment-name=$awsEnvName --version-label=$buildNumber" | |
} | |
} | |
task createCompleteFobitPackage(type: SimpleExec, group: group) { | |
description 'Creates a simple package for AWS EB. This package will be the dockerized version of the app' | |
doFirst { | |
run "jar cf build/fobit-docker.jar Dockerfile build/libs/fobit-${appVersion}.jar" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment