forked from classmethod/gradle-aws-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·118 lines (95 loc) · 3.05 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// -*- coding: utf-8; mode: groovy -*-
buildscript {
repositories {
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:1.2.1.RELEASE"
classpath "jp.classmethod.aws:gradle-aws-plugin:0.+"
}
}
apply plugin: 'java'
apply plugin: 'spring-boot'
apply plugin: "jp.classmethod.aws.beanstalk"
// ==== Project settings
group = 'jp.classmethod.aws.gradle.sample'
version = '0.1-SNAPSHOT'
ext.artifactId = '05-beanstalk'
ext.timestamp = new Date().format("yyyyMMdd'_'HHmmss", TimeZone.default)
ext.versionDesc = "${version}-${timestamp}"
ext.defaultEncoding = 'UTF-8'
sourceCompatibility = targetCompatibility = 1.8
tasks.withType(AbstractCompile) each {
it.options.encoding = ext.defaultEncoding
}
repositories {
mavenCentral()
maven { url 'http://repo.spring.io/release' }
}
dependencies {
compile "org.springframework.boot:spring-boot-starter-actuator"
compile "org.springframework.boot:spring-boot-starter-web"
compile "org.apache.tomcat.embed:tomcat-embed-jasper"
compile "javax.servlet:jstl"
}
// ==== AWS settings
aws {
profileName = "default"
region = "ap-northeast-1"
}
beanstalk {
appName "05-beanstalk"
appDesc "gradle-aws-plugin demo application"
version {
label = "05-beanstalk-${versionDesc}"
description = "${artifactId} v${version}"
bucket = "elasticbeanstalk-${aws.region}-${aws.accountId}"
key = "eb-apps/${artifactId}/${artifactId}-${versionDesc}.zip"
}
configurationTemplates {
production {
optionSettings = file("src/main/config/production.json")
solutionStackName = "64bit Amazon Linux 2015.03 v1.4.0 running Docker 1.6.0"
}
development {
optionSettings = file("src/main/config/development.json")
solutionStackName = "64bit Amazon Linux 2015.03 v1.4.0 running Docker 1.6.0"
}
}
environment {
envName = "05-beanstalk-blue"
envDesc = "foobar demo application blue environemnt"
templateName = "development"
versionLabel = "05-beanstalk-${versionDesc}"
tags = [
VERSION: "${versionDesc}".toString(),
GROUP: "Eng"
]
}
}
// ==== Other tasks
task createDockerfile(type: Copy, dependsOn: jar) {
from "src/main/bundle/Dockerfile"
into "build/bundle"
expand(jarFilename: jar.archiveName, artifactId: project.artifactId)
}
task createBundleResources(type: Copy) {
from "src/main/bundle"
into "build/bundle"
exclude "src/main/bundle/Dockerfile"
}
task createBundle(type: Zip, dependsOn: [createDockerfile, createBundleResources, bootRepackage]) {
archiveName = jar.archiveName.substring(0, jar.archiveName.length() - 4) + ".zip"
from "build/bundle"
from jar.archivePath
}
task uploadBundle(type: jp.classmethod.aws.gradle.s3.AmazonS3FileUploadTask, dependsOn: createBundle) {
group "AWS"
description "Upload ${artifactId} application bundle file to S3."
bucketName "elasticbeanstalk-${aws.region}-${aws.accountId}"
key "eb-apps/${artifactId}/${artifactId}-${versionDesc}.zip"
file project.createBundle.archivePath
overwrite project.version.endsWith("-SNAPSHOT")
}
awsEbCreateApplicationVersion.dependsOn uploadBundle