Tomm0017 / rsmod

New repository: https://github.com/rsmod/rsmod
https://github.com/rsmod/rsmod
Apache License 2.0
123 stars 100 forks source link

Use Alpine Docker image and multi-stage building #60

Open sinoz opened 5 years ago

sinoz commented 5 years ago

https://github.com/Tomm0017/rsmod/blob/master/Dockerfile#L11

The distributor of the zenika/kotlin:1.3-jdk8 image also provides Alpine images which will reduce the size down by roughly 500mb:

Screenshot from 2019-03-26 23-10-40

Though a better solution would be to make use of multi-stage building using either one of those images presented above for just building a fat JAR:

# Start with the Alpine image for building (You can also use the larger one as this image will be discarded eventually)
FROM zenika/kotlin:1.3-eap-jdk8-alpine AS builder

# Imagine Gradle commands here building our fat JAR

# Restart using probably the smallest JRE image available
FROM openjdk:8-jre-alpine

# Copy over the fat JAR
COPY --from=builder /my_fat_jar.jar /app/

This fat JAR would include everything RS MOD needs. The JAR can then be copied over to an OpenJDK based JRE image as this image is even smaller than the Kotlin Alpine one.