-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
120 lines (103 loc) · 3.92 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
119
120
plugins {
id 'java'
id 'org.springframework.boot' version '3.3.0'
id 'io.spring.dependency-management' version '1.1.5'
}
ext {
springAiVersion = "1.0.0-M1"
}
group = 'app'
version = '0.0.1-SNAPSHOT'
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}
configurations {
compileOnly {
extendsFrom annotationProcessor
}
}
repositories {
mavenCentral()
maven { url 'https://repo.spring.io/milestone' }
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
implementation 'org.springframework.cloud:spring-cloud-starter-aws:2.2.6.RELEASE'
implementation 'com.auth0:java-jwt:3.18.1'
implementation 'org.springframework.ai:spring-ai-openai-spring-boot-starter'
implementation 'org.springframework.ai:spring-ai-stability-ai-spring-boot-starter'
implementation 'io.sentry:sentry-spring-boot-starter-jakarta:7.14.0'
implementation 'net.javacrumbs.shedlock:shedlock-spring:5.8.0'
implementation 'net.javacrumbs.shedlock:shedlock-provider-jdbc-template:5.8.0'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.opensearch.client:opensearch-rest-client:2.11.0'
implementation 'org.opensearch.client:opensearch-java:2.7.0'
implementation 'com.google.guava:guava:33.3.1-jre'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
}
tasks.named('test') {
useJUnitPlatform()
}
task makeZipForDeploy(type: Exec) {
commandLine 'sh', '-c', '''
echo "Starting custom commands"
ls -la
pwd
echo "Current date:" $(date)
./gradlew clean build -Dspring.profiles.active=prod -x test
rm -rf deploy
mkdir deploy
cp build/libs/cardcapture-0.0.1-SNAPSHOT.jar deploy/
cp -R .platform deploy/
cp Procfile deploy/
rm -f deployment-package.zip
cd deploy
zip -r ../deployment-package.zip .
'''
}
task buildDockerCompose(type: Exec) {
commandLine 'sh', '-c', '''
echo "Starting custom commands"
ls -la
pwd
echo "Current date:" $(date)
# Step 1: Build the Spring Boot project
./gradlew clean build -Dspring.profiles.active=prod -x test
# Step 2: Prepare the deployment package
rm -rf deploy
mkdir deploy
cp build/libs/cardcapture-0.0.1-SNAPSHOT.jar deploy/
cp build/libs/cardcapture-0.0.1-SNAPSHOT.jar src/main/java/app/cardcapture/build
cp -R .platform deploy/
cp Procfile deploy/
rm -f deployment-package.zip
cd deploy
zip -r ../deployment-package.zip .
echo "Building Docker image"
# Step 3: Specify the path to Dockerfile
docker build -t cardcapture-app:latest -f /Users/inpink/Downloads/cardcapture/src/main/java/app/cardcapture/build/Dockerfile .
chmod -R 755 deploy
chmod 644 deploy/cardcapture-0.0.1-SNAPSHOT.jar
echo "Starting Docker Compose"
# Step 4: Run docker-compose from the correct path
docker-compose -f /Users/inpink/Downloads/cardcapture/src/main/java/app/cardcapture/build/docker-compose.yml down
docker-compose -f /Users/inpink/Downloads/cardcapture/src/main/java/app/cardcapture/build/docker-compose.yml up -d
'''
}
dependencyManagement {
imports {
mavenBom "org.springframework.ai:spring-ai-bom:$springAiVersion"
}
}