How to debug Docker size in Heroku?

I am deploying a small app in Docker to Heroku. The issue I see while running locally, the setup takes up to 400 MB. On the Heroku, while running, it skyrockets to 1.7 GB of RAM.

Dockerfile:

FROM bellsoft/liberica-openjdk-alpine-musl:11
ENV PORT=$PORT
ARG ENV
ENV STARTUP_ENV=$ENV
COPY /target/app-0.0.1-SNAPSHOT.jar /app-0.0.1-SNAPSHOT.jar
RUN echo $ENV
CMD java -Dspring.profiles.active=$STARTUP_ENV -Djava.security.egd=file:/dev/./urandom -Dserver.port=$PORT -jar /app-0.0.1-SNAPSHOT.jar

I cannot show the code, but the visualvm showed that the Kotlin app never reached more than 80 MB RAM benchmark.

How can I debug this issue?

P.S. The main concern that the app restarts automatically while running, and I lose critical data.

Source: Docker Questions

LEAVE A COMMENT