diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..09ece12 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,64 @@ +kind: pipeline +name: default +type: docker + +steps: + - name: restore-cache + image: drillster/drone-volume-cache + settings: + restore: true + mount: + - /drone/src/.gradle-cache + volumes: + - name: cache + path: /cache + + - name: build + image: openjdk:16 + commands: + - ./gradlew --no-daemon --build-cache clean assemble + environment: + GRADLE_USER_HOME: /drone/src/.gradle-cache + ORG_GRADLE_PROJECT_BUILD_VERSION: ${DRONE_TAG} + + - name: deploy + image: openjdk:16 + commands: + - ./gradlew --no-daemon --info --build-cache jib + settings: + use_cache: true + environment: + GRADLE_USER_HOME: /drone/src/.gradle-cache + ORG_GRADLE_PROJECT_DOCKER_REGISTRY: + from_secret: DOCKER_REPO + ORG_GRADLE_PROJECT_BUILD_VERSION: ${DRONE_TAG} + + - name: rebuild-cache + image: drillster/drone-volume-cache + settings: + rebuild: true + mount: + - /drone/src/.gradle-cache + volumes: + - name: cache + path: /cache + +trigger: + ref: + include: + - refs/tags/** + +services: + - name: docker + image: docker:dind + privileged: true + volumes: + - name: dockersock + path: /var/run + +volumes: + - name: dockersock + temp: {} + - name: cache + host: + path: /tmp/hits-drone-cache diff --git a/build.gradle b/build.gradle index c8faddd..7e2db47 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,7 @@ +plugins { + id "com.google.cloud.tools.jib" version "3.1.1" apply false +} + group 'com.devsoap.parsers' version '1.0' diff --git a/rest-api/build.gradle b/rest-api/build.gradle index 66c3e61..bbd9519 100644 --- a/rest-api/build.gradle +++ b/rest-api/build.gradle @@ -1,3 +1,7 @@ +plugins { + id 'com.google.cloud.tools.jib' +} + dependencies { implementation 'io.javalin:javalin:3.13.8' implementation "org.thymeleaf:thymeleaf:3.0.11.RELEASE" @@ -12,3 +16,21 @@ dependencies { } application.mainClass='com.devsoap.parsers.api.Api' + +jib { + from { + image = "openjdk:$targetCompatibility" + } + to { + def registry = findProperty('DOCKER_REGISTRY') + image = "${registry ? registry + '/' : ''}${project.group}/${rootProject.name}" + tags = [version, 'latest'] + } + container { + mainClass = "com.devsoap.parsers.api.Api" + jvmFlags = [] + ports = ['7000'] + volumes = [] + environment = [:] + } +} \ No newline at end of file