|
| 1 | +import java.time.Instant |
| 2 | + |
| 3 | +plugins { |
| 4 | + id 'java' |
| 5 | + id 'org.springframework.boot' version '3.3.4' |
| 6 | + id 'io.spring.dependency-management' version '1.1.7' |
| 7 | + id 'com.google.cloud.tools.jib' version '3.4.4' apply false |
| 8 | +} |
| 9 | + |
| 10 | +group = 'com.contentgrid.userapps.rtptestorg' |
| 11 | +version = '0.0.1-SNAPSHOT' |
| 12 | + |
| 13 | +java { |
| 14 | + toolchain { |
| 15 | + languageVersion = JavaLanguageVersion.of(17) |
| 16 | + } |
| 17 | +} |
| 18 | + |
| 19 | +configurations { |
| 20 | + compileOnly { |
| 21 | + extendsFrom annotationProcessor |
| 22 | + } |
| 23 | +} |
| 24 | + |
| 25 | +repositories { |
| 26 | + mavenCentral() |
| 27 | +} |
| 28 | + |
| 29 | +dependencies { |
| 30 | + implementation 'com.contentgrid.spring:contentgrid-spring-boot-starter:0.17.0' |
| 31 | + implementation 'org.flywaydb:flyway-core' |
| 32 | + implementation 'org.flywaydb:flyway-database-postgresql' |
| 33 | + implementation 'org.testcontainers:postgresql' |
| 34 | + annotationProcessor 'com.contentgrid.spring:contentgrid-spring-boot-starter-annotations:0.17.0' |
| 35 | + annotationProcessor 'org.projectlombok:lombok' |
| 36 | + testImplementation 'org.springframework.boot:spring-boot-starter-test' |
| 37 | + testRuntimeOnly 'org.junit.platform:junit-platform-launcher' |
| 38 | +} |
| 39 | + |
| 40 | +tasks.named('bootRun') { |
| 41 | + systemProperty 'contentgrid.security.unauthenticated.allow', true |
| 42 | + systemProperty 'contentgrid.security.csrf.disabled', true |
| 43 | + systemProperty 'contentgrid.thunx.abac.source', 'none' |
| 44 | +} |
| 45 | + |
| 46 | +tasks.named('test') { |
| 47 | + useJUnitPlatform() |
| 48 | +} |
| 49 | + |
| 50 | +def timestamp = Instant.now().getEpochSecond(); |
| 51 | + |
| 52 | +allprojects { |
| 53 | + apply plugin: com.google.cloud.tools.jib.gradle.JibPlugin |
| 54 | + |
| 55 | + pluginManager.withPlugin('com.google.cloud.tools.jib') { |
| 56 | + def imageNameProvider = project.provider { |
| 57 | + "${project.findProperty('com.contentgrid.docker.registry.name')}/${project.name}:${project.version}-${timestamp}" |
| 58 | + } |
| 59 | + jib { |
| 60 | + container { |
| 61 | + jvmFlags = ['-XX:+UseContainerSupport', '-XX:MaxRAMPercentage=85.0'] |
| 62 | + } |
| 63 | + to { |
| 64 | + image = 'docker.contentgrid.com/rtp-test-app:latest' |
| 65 | + } |
| 66 | + allowInsecureRegistries = Boolean.parseBoolean(project.findProperty("com.contentgrid.docker.registry.allow-insecure")) |
| 67 | + } |
| 68 | + project.tasks.named('jib').configure { |
| 69 | + doLast { |
| 70 | + def dockerImgFile = file('build/docker.image') |
| 71 | + println "writing ${jib.to.image} > ${dockerImgFile.absolutePath}" |
| 72 | + dockerImgFile.newWriter().withWriter { writer -> |
| 73 | + writer.write jib.to.image |
| 74 | + } |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | +} |
0 commit comments