Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springboot2打包后tar包大小是原始包大小的2倍 #149

Open
jinshubao opened this issue Dec 24, 2018 · 1 comment
Open

springboot2打包后tar包大小是原始包大小的2倍 #149

jinshubao opened this issue Dec 24, 2018 · 1 comment

Comments

@jinshubao
Copy link

配置:

buildscript {
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'https://mirrors.huaweicloud.com/repository/maven/' }
        mavenCentral()
    }
    dependencies {
        classpath('se.transmode.gradle:gradle-docker:1.2')
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.1.RELEASE")
    }
}

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

group = 'com.jean'
version = '0.0.1'
sourceCompatibility = 1.8
targetCompatibility = 1.8
[compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'


repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    maven { url 'https://mirrors.huaweicloud.com/repository/maven/' }
    mavenCentral()
    maven { url "https://repo.spring.io/milestone" }
}

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web')
    implementation('org.springframework.boot:spring-boot-starter-actuator')
    implementation('io.micrometer:micrometer-registry-prometheus')
}

dependencyManagement {
    imports {
        mavenBom "org.springframework.cloud:spring-cloud-dependencies:Greenwich.RC1"
    }
}

mainClassName = 'com.jean.demo.DemoApplication'

docker {
    baseImage = "openjdk:8"
    maintainer = 'user user@126.com'
}

distDocker {
    
    push = false
    exposePort(8080)
    setEnvironment('JAVA_OPTS', '-Xms128m -Xmx256m -Djava.security.egd=file:/dev/./urandom')
    volume("/tmp")
    volume("/logs")
    volume("/config")
}

执行 gradlew disDocker 命令后:

D:\dev\myself\user-service\build\distributions 的目录
2018/12/21  16:16        18,309,120 user-service-0.0.1.tar
 D:\dev\myself\user-service\build\docker 的目录
2018/12/21  16:19               283 Dockerfile
2018/12/21  16:19        36,526,080 user-service-0.0.1.tar

解压distributions的目录的user-service-0.0.1.tar和docker 目录下的user-service-0.0.1.tar对比之后发现:
docker目录下的user-service-0.0.1.tar包含user-service-0.0.1.jar和项目依赖的所有jar文件。
而distributions目录下的user-service-0.0.1.tar只包含一个user-service-0.0.1.jar。

请问下有什么配置或者是方法解决该问题吗?

@bjornmagnusson
Copy link
Contributor

Please translate this in english if you want it to be looked at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants