1

I'm not an experienced in Gradle or Groovy thus I would like to ask for some help and advice on how to improve my configuration.

Introduction: I have a Spring Boot 2 RESTful web server that I want to Dockerize.

Here is my Dockerfile:

FROM openjdk:11-jre-slim
VOLUME /tmp
EXPOSE ${SERVER_PORT}
ARG JAR_FILE=target/*.jar
ADD ${JAR_FILE} messenger-auth-auth.jar
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "/messenger-auth-auth.jar", "$@"]

And my build.gradle file:

buildscript {
        repositories {
            mavenCentral()
            gradlePluginPortal()
        }
        dependencies {
            classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.1.1.RELEASE'
            classpath 'com.bmuschko:gradle-docker-plugin:4.2.0'
        }
    }


    apply plugin: 'idea'
    apply plugin: 'java'
    apply plugin: 'org.springframework.boot'
    apply plugin: 'io.spring.dependency-management'
    apply plugin: 'com.bmuschko.docker-spring-boot-application'

    compileJava {
        sourceCompatibility = 11
        targetCompatibility = 11
    }

    bootJar {
        baseName = 'messenger-auth-auth'
        group = 'polubentcev.messenger'
        version  = '1.0.0'
    }

    repositories {
        jcenter()
        mavenCentral()
    }

    def springBootVersion = '2.1.1.RELEASE'

    dependencies {
        compile 'org.springframework.boot:spring-boot-starter:'+springBootVersion
        compile 'org.springframework.boot:spring-boot-starter-web:'+springBootVersion
        testCompile 'org.springframework.boot:spring-boot-starter-test:'+springBootVersion
    }

Docker image is created but I'd like to improve it, for instance, set a port as a Docker command line variable and also Gradle says that some deprecated features are used. Or maybe you know better plugins to use.

How could I improve the configuration?

Pasha
  • 1,768
  • 6
  • 22
  • 43
  • 1
    Use --warning-mode=all to see all warnings. See https://docs.gradle.org/current/userguide/build_environment.html#sec:project_properties for how to pass properties. – JB Nizet Jan 05 '19 at 20:43

0 Answers0